tags:

views:

974

answers:

2

I am running php 5.3, and have bumped into a problem I've not encountered before. I have an upload form (yes, enctype is set to multipart/form-data), that posts stuff to a php page.

The php installation has uploads enabled, and upload_max_filesize is set to .5GB.

Uploading pictures (I've tried up to 50 at a time) works fine. Uploading .zip files, however, does not. Uploading a .zip will render most global input arrays ($_POST,$_GET,$_FILES, and $_REQUEST) completely empty. A network sniff shows POST data beeing sent, as well as the zip beeing uploaded.

Apache logs show nothing out of the ordinary, and no errors are encountered. The arrays are just empty. Has anyone encountered this?

+3  A: 

I don't have a clue what the exact problem could be, but I'd suggest trying out a few modifications on the files:

  • can you upload a .jpg file that you've renamed to .zip?
  • can you upload a .zip file that you've renamed to .jpg?
  • try uploading a smaller .zip file, just to make sure it does actually get transfered.
  • try uploading a .jpg with a bigger filesize

Hopefully this will give a pointer about where the problem lies. For what it is worth, I doubt that the problem is in PHP.

ylebre
+1 Sound advice. Also worth adding that the max_input_time and max_execution_time settings in php.ini could break file uploads if they aren't high enough.
karim79
I didn't try a smaller zip - but doing it proved it was a file size problem. I still haven't found the source of it, but at least I know what direction to look!
Jacob Hansson
A: 
Ozzy
He's already said he has it set to 5GB.
karim79
Depends on how he set it. You can set it in many ways from editing the php.ini directly or in .htaccess. This makes sure that its set when the script is running
Ozzy
Setting upload max filesize at the script level doesn't work, does it? I was under the impression that the upload portion (and its associated restrictions) occurs *before* the script actually gets loaded...
Narcissus
Well as the OP posted, the file is uploaded properly in apache logs. would make sense if when the file is passed into PHP the previous settings could get reset so you set upload max filesize in the script
Ozzy