Pickle Posted May 9, 2008 Share Posted May 9, 2008 Hello everyone, i could do with some help. Basically i have written a script that takes info and 2 images from a form, uploads the 2 images to a folder on the server and then sends emails. however at the moment if the images are nearing 1MB (individually) then after the script has uploaded the images to the server it stops. im not sure what to do. ive tried changing the set_time_limit but it makes no difference. Does anyone know why this could be happening? any help would be great. thanks in advance Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 9, 2008 Share Posted May 9, 2008 You'll need to check your PHP's settings for max_execution_time,max_input_time, memory_limit, post_max_size and upload_max_filesize as well as ensuring that the hidden form field containg the maximum file size is not exceeded. Quote Link to comment Share on other sites More sharing options...
Pickle Posted May 10, 2008 Author Share Posted May 10, 2008 Hi thanks for your reply, really appreciate the help. I am pretty sure that the hidden field in my form containing the maximum file size has not been exceeded. the value is set to 4194304 which should be fine for 2 - 2m files?! once i have checked these other settings are they easily changeable? and would i need to do this before the script starts? thanks for your advice. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 10, 2008 Share Posted May 10, 2008 Change them in php.ini and restart your web server. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 10, 2008 Share Posted May 10, 2008 the value is set to 4194304 which should be fine for 2 - 2m files?! Well, the value is in bytes. The value you've set is exactly 4mbs, so you might want to increase it a bit. Quote Link to comment Share on other sites More sharing options...
Pickle Posted May 12, 2008 Author Share Posted May 12, 2008 hi guys thanks for your replies. i dont have my own server, so unfortunately i cant change the php.ini file and restart the server. is there another way to change them in the script? for example can i write the following at the beginning of my script and it be ok? ini_get('max_execution_time'); //to find out what it currently is set('max_execution_time'); //to change it to something else? and thanks GingerRobot, i will take your advice and increase it. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 12, 2008 Share Posted May 12, 2008 Yes, it is possible to change some of the settings with the ini_set() function, but not all of them. For example, the upload_max_filesize cannot be altered with the function (for a list of what can and what cannot, see here) Also, i wouldn't be surprised to find that your host has prevented you changing these settings anyway to prevent someone using excessive system resources. It might be worth contacting your host too. Quote Link to comment Share on other sites More sharing options...
Pickle Posted May 12, 2008 Author Share Posted May 12, 2008 ok thanks, i really appreciate the help. I'll let you know the outcome. Quote Link to comment Share on other sites More sharing options...
Pickle Posted May 12, 2008 Author Share Posted May 12, 2008 hello im back :-\ I have had the settings changed to the following: max_execution_time = 200 // i change this at the beginning of the script max_input_time = 200 memory_limit = 8M post_max_size = 8M upload_max_filesize = 8M However it still seems to quit. im finding that it quits after it uploads the images. basically the script runs in this order: 1. enters new info into the database 2. uploads the images 3. attaches the images to an email 4. send the emails out. it quits after stage 2. There cant be anything wrong with the script since it goes through the motions fine if the file sizes are smaller. any ideas? Quote Link to comment Share on other sites More sharing options...
Pickle Posted May 15, 2008 Author Share Posted May 15, 2008 Hi everyone just to let you all know that its now sorted. In the end it was because upload_max_filesize and post_max_filesize were not high enough. The host changed them to 38M, way too high just to eliminate those from the problem and it worked. I was testing the script using two images of about 2MB, so i assumed that 8M would be more than enough but i was wrong. thanks again for your help in solving the problem. really appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.