Restart Upload?

I've being hunting down my own #2038 errors. I have found PHP identifies some of them as partial uploads ($_FILES['Filedata']['error'] == UPLOAD_ERR_PARTIAL). I would like to automatically restart these files (maybe retry three times) without troubling the user with reselecting the file.

Is there a restartUpload(fileid) equivalent? I thought maybe calling startUpload(fileid) but I cannot duplicate the error myself to test this. Any ideas?

Does anyone have any input

Does anyone have any input on this?

gyphie's picture

requeue_on_error

There is a requeue_on_error setting. If an "uploadError" occurs the file is added back to the start of the queue.

In your handler you can cancel or restart the upload. As for # of retries, you'll have to track that yourself. You might use a retry array:


var retries = {};

function uploadErrorhandler (file) {
retries[file.id]++;

if (retries[file.id] > 3) {
this.cancelUpload(file.id);
} else {
this.startUpload(file.id);
}
}

I didn't test this code. It's just conceptual.

Thanks

That works great. Thanks. Smiling