You are here: Re: readfile_and_downloads « PHP Programming Language « IT news, forums, messages
Re: readfile_and_downloads

Posted by Cousin Stanley on 12/03/05 17:19

> @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.
>

Sjoerd ....

Yes, this is my primary concern ....

The files I'm currently dealing with
are in the CD-Sized range ~ 600 MB ....

> @Cousin: Please read the comments on
> http://www.php.net/manual/en/function.readfile.php.

Thanks for pointing me toward the on-line php docs ....

I have local copies under Debian Linux
but they don't include the additional
and informative user feedback ....

> They say that readfile is slower,
> modifies the "last-modified" time
> and reads the entire file in memory.

Most all of the comments there regarding readfile
seemed interesting ....

> You are probably better off with a fread loop:

I think so too, and more so
after reading the on-line docs ....

> $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.

I am aware that there is a limit,
and will look into learning how
to deal with it ....

> Another possibilty 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" ) ;

When you redirect with a Location header in this manner
what is the actual download function that is called ?

In otherwords, would the redirection call readfile()
to transfer ?

If I pre-log before the redirection
it seems that it might be difficult
to know whether or not the download
was fully completed and how much data
was actually transferred in cases
where the download was incomplete ....

Thanks very much for the reply ....

It's greatly appreciated ....


--
Stanley C. Kitching
Human Being
Phoenix, Arizona


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

 

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

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