PHP: Problem with filesize

Posted by BlaM on Stack Overflow See other posts from Stack Overflow or by BlaM
Published on 2010-04-09T17:07:08Z Indexed on 2010/04/09 17:13 UTC
Read the original article Hit count: 420

Filed under:
|
|

I need a little help here:

I get a file from an HTML upload form. And I have a "target" filename in $File.

When I do this:

copy($_FILES['binfile']['tmp_name'], $File);
echo '<hr>' . filesize($_FILES['binfile']['tmp_name']);
echo '<hr>' . filesize($File);

Everything works fine. I get the same number twice.

However when I delete the first call of filesize(), I get "0" (zero).

copy($_FILES['binfile']['tmp_name'], $File);
echo '<hr>' . filesize($File);

Any suggestions? What am I doing wrong? Why do I need to get the filesize of the "original" file before I can get the size of the copy?

(That's actually what it is: I need to call the filesize() for the original file. Neither sleep() nor calling filesize() of another file helps.)

System:

  • Apache 2.0
  • PHP 5.2.6
  • Debian Linux (Lenny)

© Stack Overflow or respective owner

Related posts about php

Related posts about filesize