You are here: Re: newbie: filesize() trouble! « PHP Language « IT news, forums, messages
Re: newbie: filesize() trouble!

Posted by Rik on 01/18/07 12:09

Jeff wrote:
> Hey
>
> The code below gives this error message when I submit a file:
> Warning: filesize() [function.filesize]: stat failed for
> C:\WINDOWS\TEMP\php3D.tmp in C:\Inetpub\wwwroot\demo\pic.php on line
> 18
>
> What am I doing wrong here? is it because the parameter to filesize()
> is actually a temp file?

> <?php
> if (!empty($_FILES["userfile"])) {
> $instr = fopen($_FILES['userfile']['tmp_name'], "rb");
> $file = $_FILES['userfile']['tmp_name'];
> echo filesize($file);
> }
> ?>

What happens if you close the filehandle (fclose($instr)) before polling
for filesize? Or you retrieve the fileszie before fopen()ing it?

Then again, why not use $_FILES['userfile']['size']...
--
Rik Wasmus

 

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

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