You are here: Re: simple file transfer « PHP Programming Language « IT news, forums, messages
Re: simple file transfer

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация