Bluehost.com Web Hosting $6.95

The best method to send a large file to client?

This is a discussion on The best method to send a large file to client? within the PHP Language forums, part of the PHP Programming Forums category; Arjen wrote: > howachen@gmail.com schreef: >> I have many text file with 1 to 2MB in size &...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 10-05-2006
Colin McKinnon
 
Posts: n/a
Default Re: The best method to send a large file to client?

Arjen wrote:

> howachen@gmail.com schreef:
>> I have many text file with 1 to 2MB in size
>>
>> currently, i use the method:
>>
>> echo file_get_contents( $file_path );
>>
>>
>> are there any better method?
>>
>> thanks.

>
> Yup .. stream the file.
>
> file($file_path);


You'll run out of memory very quickly using file(...) or
file_get_contents(...) on big files.

C.

Reply With Quote
  #12 (permalink)  
Old 10-06-2006
howachen@gmail.com
 
Posts: n/a
Default Re: The best method to send a large file to client?


NC 寫道:

> On Oct 5, 12:17 am, howac...@gmail.com wrote:
> >
> > I have many text file with 1 to 2MB in size
> >
> > currently, i use the method:
> >
> > echo file_get_contents( $file_path );
> >
> > are there any better method?

>
> Yes. Use readfile():
>
> http://www.php.net/readfile
>
> Cheers,
> NC


thanks all...

seems readfile() is the best method

Reply With Quote
  #13 (permalink)  
Old 10-06-2006
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default |OT| Re: The best method to send a large file to client?

NC wrote:
> On Oct 5, 12:17 am, howac...@gmail.com wrote:
> >
> > I have many text file with 1 to 2MB in size
> >
> > currently, i use the method:
> >
> > echo file_get_contents( $file_path );
> >
> > are there any better method?

>
> Yes. Use readfile():
>
> http://www.php.net/readfile


When I read the responses in this thread, I was wondering what
happened to c.l.php (obvious shortage of PHP saints). Fortunately,
still Nikolai Chuvakhin is hacking PHP...:-)

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0