I am uploading two different type of file with ajax by using two different function. The problem is->the timeout which is set for the first request has been set for other request also.. so if first file is too large and take almost 2 mins for uploading, then next file which is an image of very small size uploaded by next ajax request with a different time out will be also take same 2 mins for uploading.. here i am uploading file directly to amazon.
Below is the ajax function to upload my second file with a small timeout
xhr_request1=$.ajax({
url: 'uploader.php', //server script to process data
type: 'POST',
//Ajax events
beforeSend: function(){beforeSendHandler(fileLoading);},
success: function(response) {completeHandler(response,fileName,fileLoading,filePreview,fileUpload,filename);},
// error: function(xhr,tStatus,err ) {errorHandler(err,fileLoading,filePreview);},
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false,
timeout:50000
});
and below is next function to upload large files
xhr_request2=$.ajax({
url: 'contentuploader.php', //server script to process data
type: 'POST',
//Ajax events
beforeSend: function(){beforeSendHandler1(fileLoading1);},
success: function(response) {completeHandler1(response,fileName1,fileLoading1,filePreview1,fileUpload1,filename1);},
// error: function(xhr,tStatus,err ) {errorHandler(err,fileLoading,filePreview);},
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false,
timeout:1000000
});