Timeout?

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Timeout?

djXternal
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

Reply

vujsa
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

Reply

djXternal
QUOTE(vujsa @ Nov 2 2006, 11:45 AM) *

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

 

 

 


Reply

TavoxPeru
QUOTE(djXternal @ Nov 1 2006, 09:32 PM) *

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:

CODE
<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:

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

Best regards,

Reply

djXternal
QUOTE(TavoxPeru @ Nov 3 2006, 08:36 PM) *

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:

CODE
<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:

CODE
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.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : timeout


    Looking for timeout






*SIMILAR VIDEOS*
Searching Video's for timeout
advertisement




Timeout?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE