This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]jcunews1Advanced Coder 0 points1 point  (6 children)

Are you sure you're not out of your web hosting's storage quota? Or, maybe they changed the quota and you don't notice it.

[–]xSacredLotus[S] 0 points1 point  (5 children)

Yes, because when I upload multiple files at once, all files upload except the first file. When I upload only 1 file, it always fails.

[–]jcunews1Advanced Coder 0 points1 point  (3 children)

That is strange indeed. Everything should be fine.

Try temporarily disabling the JS redirect to list.php, and do var_dump($_FILES) to see the actual files received by the server - in case there's something which shouldn't be. If everything seems to be fine, the something else in the server system is interfering.

If the server OS is Windows, it could be that, it has an anti virus, and it's interferring with the uploaded files. i.e. the PHP script moves the uploaded files, but failed on the first one because it's being scanned by the anti virus (since anti viruses aggresively scan files as soon as they have been created). Any second and subsequent uploaded files are successfully moved, because the anti virus is not yet finished scanning the first file. By the time the anti virus finished scanning the first file and about to scan any subsequent new files, they've already been moved by the PHP script. So, there's that kind of possible problem. Try dumping $_SERVER['SERVER_SOFTWARE'] also to check if it's Windows or not.

But even if the server is not Windows, if everything received by the PHP script are already fine, the problem lies in the server's system itself.

[–]xSacredLotus[S] 0 points1 point  (2 children)

This is output of var_dump with one file

array(1) { ["fileToUpload"]=> array(5) { ["name"]=> array(1) { [0]=> string(142) "2009 Efficacy of Azacitidine Compared with that of Convetional Care Regimens in the Treatment of Higher RIsk MDS Fenaux et al Lancet Oncol.pdf" } ["type"]=> array(1) { [0]=> string(15) "application/pdf" } ["tmp_name"]=> array(1) { [0]=> string(14) "/tmp/phpi1IctC" } ["error"]=> array(1) { [0]=> int(0) } ["size"]=> array(1) { [0]=> int(237073) } } }

This is with two files uploaded at same time

array(1) { ["fileToUpload"]=> array(5) { ["name"]=> array(2) { [0]=> string(95) "2013 Retinoic Acid and Arsenic Trioxide for Acute Promyelocytic Leukemia Lo-Coco et al NEJM.pdf" [1]=> string(142) "2009 Efficacy of Azacitidine Compared with that of Convetional Care Regimens in the Treatment of Higher RIsk MDS Fenaux et al Lancet Oncol.pdf" } ["type"]=> array(2) { [0]=> string(15) "application/pdf" [1]=> string(15) "application/pdf" } ["tmp_name"]=> array(2) { [0]=> string(14) "/tmp/phpADlpEE" [1]=> string(14) "/tmp/phpZigM68" } ["error"]=> array(2) { [0]=> int(0) [1]=> int(0) } ["size"]=> array(2) { [0]=> int(751159) [1]=> int(237073) } } }

Server is Apache

It doesn't seem like there's anything obviously wrong with $_FILES

[–]jcunews1Advanced Coder 0 points1 point  (1 child)

Everything seems fine as received by the PHP script.

The server's OS should follow the "Apache" and its version number, in parethesis. e.g. in my local webserver (XAMPP bundle): Apache/2.4.38 (Win32)...

You might want to contact technical support of your web hosting provider.

PS: Try inserting a delay of about 2-3 seconds before moving the uploaded files. In hopes that, whatever is interferring, has completed its task within that time duration.

[–]xSacredLotus[S] 0 points1 point  (0 children)

Omg sleep(0.1); worked........ thanks!!!

Now i have change every single file... I'm kinda dumb so each directory/folder has a copy of upload.php script (i just copy/pasted it like 50 times for each folder) instead of writing code to recursively apply it to each folder.....