How to long poll this AJAX request

I have a click function that triggers a php script through AJAX. The php script starts a video upload to Vimeo. My problem is the Apache server is set to timeout after 5 minutes and I do not have root access to configure this. I can see the uploading takes place for exactly 5 minutes…then crashes…503 timeout error.

How do I long poll the server with this Ajax function? So how can I check every 10 seconds if there is a response and keep checking longer than 5 minutes. (Some uploads can take 15+ minutes)

$('#videoSubmit').on('click', function(event) {
     ........
    .......
    $.ajax({
        url: 'create_vimeo_upload.php',
        dataType: 'text', 
        cache: false,
        contentType: false,
        processData: false,
        data: video_data,                         
        type: 'post',
        dataType: 'HTML',
        success: function(response){
                   tmpdiv.innerHTML += '<br/>' + response;    
       }
     });
 });

I was going to say something similar, but this stack overflow article does a pretty good job…

This is the error im getting from the server at 5 minutes.

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

The problem is I cannot use that long polling method because Im posting data ONCE and dont want to repeat it. Im posting the file name and path. Ive I keep polling with ajax it will keep starting the upload of the video. As i understand it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.