I am using GAE with Python 2.7 to make a website which can upload files with ascii data to the blobstore. The code I am using for this is pretty much the same as given in th
We solved this 10 minute timeout problem by implementing a small amount of Javascript which every 9 minutes sends an ajax request to a URL which sends back a new blob upload URL and swaps out the form.
The /ajax/blob
URL takes a success url, and then calls create_upload_url()
and returns it as an ajax data object.
Here's the Javascript we wrote:
if ($('#blobUploadForm').length > 0) {
setTimeout(_getNewBlobstoreUrl, 9 * 1000 * 60 * 60); // 9 minutes
} //do nothing if there is no uploadUrl id
function _getNewBlobstoreUrl() {
var successUrl = $('#uploadUrl').attr('value');
if (typeof successUrl == 'undefined') {
return;
}
var url = "/ajax/blob?url=" + successUrl;
$.ajax({
url: url,
dataType: "json",
cache: false,
async: true,
success: _getNewBlobstoreUrlSuccess,
error: _getNewBlobstoreUrlError
})
function _getNewBlobstoreUrlSuccess(data) {
if (data.url) {
//change the action to a new action
$('#blobUploadForm').attr('action', data.url)
}
}
function _getNewBlobstoreUrlError(err) {
// do something
}
Don't forget at the end to setup the timeout again too (or use setInterval?), in case the user takes a really long time to fill in the form.