We have recently replaced our flash-based uploader with this ajax one:
http://valums.com/ajax-upload/
Unfortunately, this uses the POST mechanism to transfer data to the server, which means that if I have a 50MB upload limit, I need to add at least 50MB to my PHP ini, as the data is added into the $_POST array.
Unfortunately, this means that all pages now have this huge added limit, which is not acceptable. I cannot even set the limit for the page on the fly, since using the ini_set would occur AFTER the $_POST processing had occurred. Can anyone think of an alternate solution?
In addition, anything exceeding the max limit causes a PHP seg fault / Fatal Error! Any ideas?
You can do something like this in Apache in the .conf file for your site’s configuration:
That makes the higher memory limit apply only to scripts invoked
/upload.phpin the URL. You can do similar overrides with<Files>,<FilesMatch>,<Directory>, etc…The override has to be done at this level, since as you’ve found out, by the time ini_set would get executed, the script’s already been killed.