Jump to content
xisto Community
djXternal

Timeout?

Recommended Posts

Is there a timeout setting or something of the sort in PHP or Apache? I'm building a file upload script that uploads a file and then adds a db entry in mysql with the file name and other info.... When I upload pictures everything works fine but when I upload larger .mov files it takes a little while which is expected then when the page loads my scripts tells me some of the fields were empty. If I echo all set variables, which contain the data from the fields, all of them are empty and I cannot figure out whyAny help is appreciated

Share this post


Link to post
Share on other sites

Is the movie file getting saved?

 

My guess is that your problem is with the max_file_size! without seeing your code, it is hard to tell for sure but here is the PHP link for such things:

http://us2.php.net/manual/en/features.file-upload.php

 

Now, there is another thing that you have to consider.

 

You set your file upload form to use the POST method.

All of your file attributes are retrieved using the $_FILES global variable BUT your other form input variables are retrieved in the usual way with the $_POST global!

 

There is a set_time_limit function but I'm not sure how it is used. I've not needed it in the past. Most of the user notes on that page seem to be from confused users. Doesn't really clear things up much.

 

I hope this helps some.

 

vujsa

Share this post


Link to post
Share on other sites

Is the movie file getting saved?

 

My guess is that your problem is with the max_file_size! without seeing your code, it is hard to tell for sure but here is the PHP link for such things:

http://us2.php.net/manual/en/features.file-upload.php

 

Now, there is another thing that you have to consider.

 

You set your file upload form to use the POST method.

All of your file attributes are retrieved using the $_FILES global variable BUT your other form input variables are retrieved in the usual way with the $_POST global!

 

There is a set_time_limit function but I'm not sure how it is used. I've not needed it in the past. Most of the user notes on that page seem to be from confused users. Doesn't really clear things up much.

 

I hope this helps some.

 

vujsa

 

Well I didnt find anything there that fixed my problem, It seems like the file is too big for the server to take because at the very beginning of my script I have all the fields echoed and all are blank, so the field are rendered empty before the script even begins. I thought that possible it was IE causing the problem, but I tried uploading in Firwfox also and it still did not work

Share this post


Link to post
Share on other sites

Is there a timeout setting or something of the sort in PHP or Apache? I'm building a file upload script that uploads a file and then adds a db entry in mysql with the file name and other info.... When I upload pictures everything works fine but when I upload larger .mov files it takes a little while which is expected then when the page loads my scripts tells me some of the fields were empty. If I echo all set variables, which contain the data from the fields, all of them are empty and I cannot figure out why
Any help is appreciated

Yes there are, the php function set_time_limit and the php.ini configuration setting max_execution_time, both controls how much time in seconds a script can run, if your script reach this value it produces a fatal error, the default value is of 30 seconds or, if it exists, the max_execution_time value defined in the php.ini, you can set this value to zero with the set_time_limit function, so no time limit is imposed and your script runs indefinitely.

The other setting that you take in mind is the php.ini configuration setting max_input_time, that sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads.

Other considerations to take in mind are the maximum size of your uploading files, you control this by using in your uploading form a hidden input named MAX_FILE_SIZE and setting its value property to the maximum size allowed in bytes for your uploading files. If you use this, you must put it before your input file control, for example, the following allows to upload a file of maximum 2Mb:

<input type="hidden" name="MAX_FILE_SIZE" value="2097152"><input type="file" name="upload" size="30">
Also, in your script you can verify if your script receives a file and if it does not exceeds your maximum file size you define in your uploading form by checking the size of your uploading file control with the following:

if( ($_FILES['upload']['size'] == 0) ){		die("Error... Your file exceeds the maximum file size allowed");	   exit(); }
Best regards,

Share this post


Link to post
Share on other sites

Yes there are, the php function set_time_limit and the php.ini configuration setting max_execution_time, both controls how much time in seconds a script can run, if your script reach this value it produces a fatal error, the default value is of 30 seconds or, if it exists, the max_execution_time value defined in the php.ini, you can set this value to zero with the set_time_limit function, so no time limit is imposed and your script runs indefinitely.
The other setting that you take in mind is the php.ini configuration setting max_input_time, that sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads.

Other considerations to take in mind are the maximum size of your uploading files, you control this by using in your uploading form a hidden input named MAX_FILE_SIZE and setting its value property to the maximum size allowed in bytes for your uploading files. If you use this, you must put it before your input file control, for example, the following allows to upload a file of maximum 2Mb:

<input type="hidden" name="MAX_FILE_SIZE" value="2097152"><input type="file" name="upload" size="30">
Also, in your script you can verify if your script receives a file and if it does not exceeds your maximum file size you define in your uploading form by checking the size of your uploading file control with the following:

if( ($_FILES['upload']['size'] == 0) ){		die("Error... Your file exceeds the maximum file size allowed");	   exit(); }
Best regards,

My problem actually ended up being in the php.ini file, the section that limits max size for POST data was set at 8M so I just had to change that to a larger size to allow for the larger video uploads.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.