Reply to Re: readfile_and_downloads

Your name:

Reply:


Posted by Sjoerd on 10/28/76 11:33

@Sean: He is not worried about performance, he is worried that he will
not have enough memory to let 10 users download a 1 GB file.

@Cousin: Please read the comments on
http://www.php.net/manual/en/function.readfile.php. They say that
readfile is slower, modifies the "last-modified" time and reads the
entire file in memory. You are probably better off with a fread loop:

$fp = fopen("filename", "r");
while ($data = fread($fp, 100000)) {
echo $data;
}
fclose($fp);

One more thing to think about: normally, PHP pages have a maximum
execution time of 30 seconds. Use set_time_limit to allow transfer
taking longer than 30 seconds.

Another possibility is to have the PHP script do logging and what not,
and then redirect to the actual file:

header("Location: http://my.host.com/actual.file");

[Back to original 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

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