File Upload problem

  • Answered
My site allows certain types of document uploads, which usually work fine until the document size gets large. It seems to vary by type but generally if they get around 1.5 or 2 Meg, it fails and spews the actual binary file contents on the screen. Of course I've checked the php.ini to see what the upload_max_filesize is and it's set at 256 Meg (not that I'd ever allow them to upload one that big). So does anyone have any idea what other things I need to check? I don't see any errors in the log files pertaining to this. Let me clarify that I'm inserting these documents into a blob field on a database and not in a folder -- if that matters.

Ok, I'm having to post my followup question here because your site keeps asking me to "post your text in the comment section" even though I've done that. So I got root access. But it doesn't do me much good if I can't add the max_allowed_packet change, or any other change, to the my.cnf file. I can't "sudo" because I'm not in the "sudoers" file and I can't chmod because I don't have permissions to do that either. Catch-22. So what do I do? Can someone just change my max_allowed_packet to 32M ? Thanks
Tim S.
Hi kleeh, Thanks for posting your question. I'm sorry you're having issues with storing the uploaded files in a database. I'm more than happy to assist you. Basically, when you store a file in a blob, it converts the file to binary and stores the binary code in the field in the database. Since it is stored as one large packet you'll need to check your max_allowed_packet in the /etc/my.cnf Here's the code snippet to look for and change:


You can change this setting to whatever you'd like to set the max packet size. Keep in mind, you'll need root access to edit the my.cnf file. If you do not have root access and wish to gain it please see our article on "Gaining Root Access". If you do not wish to have root access, you can submit an email request to have the setting changed. If you request us to change the setting via an email to [email protected] please be sure to verify your email by providing the last four digits of the credit card on file or the current AMP password. If you need further assistance please feel free to contact us. Thanks! Tim S