I am having all sorts of problems getting larger uploads to get processed by the form. My host doesn't allow me to configure php.ini, but will allow .htaccess.

My .htaccess is:

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 40M

My host advised upping the memory limit to 40MB.

The error returned is:

Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 13751236 bytes) in [path to script] on line 8860

My host says the script is trying to use more than 40MB, which does seem the case, judging by the error. They wish to know if the script is doing anything to the file (like compressing it, or processing it in some way) which may account for the extra memory usage.

The only clue to the mystery is that when I modify the script to use the file repository (rather than having the upload emailed to me as an attachment) the upload goes through fine. This would suggest that the script is failing when it attempts to email me with the attachment.

I don't mind having the uploads stored on the server, but I would rather have them emailed back to me for convenience sake.

The upload in question is a 9MB zip file, containing a TIFF image file.

Does anyone know how it could be utilising more than 40MB?