Jump to content

[SOLVED] Script crashes after move_uploaded_file


Pickle

Recommended Posts

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.