|
Re: PHP Help!
I have had a quick look and it looks like the file is not being written fast enough so by the time it gets to line 29 ($fsize = filesize($dst)) the file can not be found. I can only assume that the processing continues immediately after the line copy($src, $dst) and the OS hasn't written the file yet. That would explain why small files work and large files don't. I've never used the usleep() function before but I can guess that it will act as a pause so either increase this and see what happens.
If it is what I suspect then there are several ways around this:
1. put a loop in to check for the existance of the file before continuing, use the file_exists() function.
2. use the system() function to do the copying. It should then wait for OS to finish processing before it continues processing the script.
3. if all you are after is the file size then you should be able to do something like $fsize = $_FILES['upfile']['size'][$idx] to get the size of the current file.
|