Search code examples
formsuploadexpressionenginesafecracker

Expression Engine and Safecracker - Problems when uploading an mp3 file


I have 2 mp3 files with sizes 24.7kb and 11mb.

When I try to upload the smaller file, I get no errors.

When I try to upload the bigger file, I get an error. In firebug, I see something like

NetworkError: 404 Not Found - http://domain.com/application/form/%3C!DOCTYPE%20HTML%3E%3C!--%5Bif....

After checking and parsing the string after "form/", it seemed to be the markup of the webpage you are on.

Any idea why this happens?

P.S.

  • I have checked my PHP.ini and Expression Engine's file upload preferences and made sure that my maximum file size limit is more than 10mb(used 20mb).

  • I am using ExpressionEngine for my framework and Safecracker for my forms

  • On Mac, it seems the markup string is shown somewhere in the DOM and you can see it in the page. I don't see it in Firefox or Chrome though


Solution

  • This is probably still a server issue, rather than something EE specific. I would start by checking the following settings in php.ini (in addition to upload_max_filesize which it sounds like you've already bumped up, in roughly the following order:

    max_execution_time sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. I think the most likely candidate is this one, as it's quite possible that this is being exceeded during the upload or post-upload processing. Default in PHP 5.3 is "30"

    post_max_size (must be greater than upload_max_filesize). Sets max size of post data allowed and also affects file uploads. Default in PHP 5.3 is "128M" but some hosts reduce it considerably.

    memory_limit sets the maximum amount of memory in bytes that a script is allowed to allocate. Unlikely to be this one as you'd almost certainly get a PHP error instead, but worth a check for completeness. Default in PHP 5.3 in is "8M"