Reply to Re: Basic Filesize() call fails

Your name:

Reply:


Posted by Daniel Tryba on 05/29/05 05:35

IWP506@gmail.com wrote:
> $op1f = fopen("./test.txt","r");
> $op1 = fread($op1f, filesize($op1f));
>
> Warning: filesize() [function.filesize]: stat failed for Resource id #3
> in C:\Program Files\Apache
> Group\Apache2\htdocs\php\php\pickone\php\index.php on line 11
>
> I know it's something stupid I'm doing, but I simply can't figure it
> out!

Read the manual page (http://nl2.php.net/filesize) carefully, It's
contains the prototype of filesize():
int filesize ( string filename )

Thus the only argument to filesize should be a string containing the
name of the file. You error reports that the argument passed in your
script is a resource and thus not a string.

BTW you lack any errorhandling, so an other error will appear to the
user in case eg test.txt doesn't exist or is not readable...

[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

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