|
Posted by Chung Leong on 05/17/06 01:41
Benny Schudel wrote:
> hello
>
> how can i simple transfer a file from a server to my server and display
> the progress with ajax in the users browser?
>
> i've tried with curl, but i cant get the progress.
> are there any libraries for simple file transfers out there?
>
> kind regards
> //B
You can attend a callback function to a PHP stream. I am not sure if
it's sufficient for what you're trying to do. From an old post:
$context = stream_context_create(array());
stream_context_set_params($context,
array('notification' => 'stream_callback'));
$f = fopen("http://www.google.com/", "rb", false, $context);
The parameters passed to the function are as followed:
function stream_callback(
$notifycode,
$severity,
$xmsg,
$xcode,
$bytes_sofar,
$bytes_max)
Notification codes are defined as such:
1 = RESOLVE
2 = CONNECT
3 = AUTH_REQUIRED
4 = MIME_TYPE_IS
5 = FILE_SIZE_IS
6 = REDIRECTED
7 = PROGRESS
8 = COMPLETED
9 = FAILURE
10 = AUTH_RESULT
Severity codes:
0 = INFO
1 = WARNING
2 = ERROR
[Back to original message]
|