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]
|