Archive for the ‘Flash’ Category

Flash 8 File Uploader Timeout bypass

Tuesday, July 24th, 2007

Flash has built in timeout support.

Apparently, it’s baked into the SWF and cannot be modified by anything other than eating through compiled SWF binary.

This timeout is very evident when you’re using a flash uploading component, and you’re uploading files of close to or over 60MB. This problem can be averted if you make a background process that tricks Flash. See, Flash thinks that while this long upload is processing, the script “times out”.

The following is one method I’ve used successfully to bypass this issue:

var timeoutInt:Number; // Interval handle

runner1 = function() {
clearInterval(timeoutInt);
var time:Number = Math.round(Math.random() * 10 + 10);
timeoutInt = setInterval(“runner2″, time);
}

runner2 = function() {
clearInterval(timeoutInt);
var time:Number = Math.round(Math.random() * 10 + 10);
timeoutInt = setInterval(“runner3″, time);
}

runner3 = function() {
clearInterval(timeoutInt);
var time:Number = Math.round(Math.random() * 10 + 10);
timeoutInt = setInterval(“runner1″, time);
}

Those functions will make a valid background process, but you also need to start and stop it:
file_fr is a FileReference object.
list_obj is a listener attached to file_fr.

list_obj.onComplete = function(){
clearInterval(timeoutInt);
}
list_obj.onCancel = function(){
clearInterval(timeoutInt);
}
uploadFile = function() {
runner1();
file_fr.upload(“targeturl”);
}