NYCPHP Meetup

NYPHP.org

[nycphp-talk] length parameter

Jonathan hendler at simmons.edu
Thu Aug 18 17:18:07 EDT 2005


I'm just quoting the PHP.net site again.
Sorry if you've tried these things already.
Is it a binary file?

With large files you might need to break it up:


|<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);
}
fclose($handle);
?> |

    *Note: * If you just want to get the contents of a file into a
    string, use *file_get_contents()*
    <http://us3.php.net/manual/en/function.file-get-contents.php> as it
    has much better performance than the code above.



Steve Rieger wrote:

> sorry for the disclaimer....
>
>
>
> anyways
>
> the file is actually 958 MB large, it is mounted via nfs (that might 
> make a difference) 
>
> any file thats smaller than 230 MB i can download but any file that is 
> larger than 250 i get that error. 
>
> me no understand.
>
>
>
>
> On Aug 18, 2005, at 5:00 PM, Jonathan wrote:
>
>> Hi Steve
>>
>> See in this example from php.net
>>
>> |$filename = "/usr/local/something.txt";
>> $handle = fopen($filename, "r");
>> $contents = fread($handle, filesize($filename));
>> fclose($handle);
>>
>> |What  is happening for you is that the second parameter is 0 or less.
>> This means that the file you are trying to load is probably empty.
>>
>> Steve Rieger wrote:
>>
>>>what does this mean
>>>
>>>any pointers
>>>
>>>*Warning*:  fread(): Length parameter must be greater than 0. in  
>>>*/http/..../.../filegetter.inc* on line *191*
>>>      
>>>
>
> ------------------------------------------------------------------------
> This e-mail is intended only for the named person or entity to which 
> it is addressed and contains valuable business information that is 
> privileged, confidential and/or otherwise protected from disclosure. 
> Dissemination, distribution or copying of this e-mail or the 
> information herein by anyone other than the intended recipient, or an 
> employee or agent responsible for delivering the message to the 
> intended recipient, is strictly prohibited. All contents are the 
> copyright property of TBWA\Chiat\Day, its agencies or a client of such 
> agencies. If you are not the intended recipient, you are nevertheless 
> bound to respect the worldwide legal rights of TBWA\Chiat\Day, its 
> agencies and its clients. We require that unintended recipients delete 
> the e-mail and destroy all electronic copies in their system, 
> retaining no copies in any media. If you have received this e-mail in 
> error, please immediately notify us via e-mail to 
> disclaimer at tbwachiat.com <mailto:disclaimer at tbwachiat.com>. We 
> appreciate your cooperation.
>
> We make no warranties as to the accuracy or completeness of this 
> e-mail and accept no liability for its content or use. Any opinions 
> expressed in this e-mail are those of the author and do not 
> necessarily reflect the opinions of TBWA\Chiat\Day or any of its 
> agencies or affiliates.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>New York PHP Talk Mailing List
>AMP Technology
>Supporting Apache, MySQL and PHP
>http://lists.nyphp.org/mailman/listinfo/talk
>http://www.nyphp.org
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20050818/29903421/attachment.html>


More information about the talk mailing list