PDA

View Full Version : Flex File I/O Error #2038 when uploading large amount of images


manovotny
04-27-2007, 02:47 PM
I'm using Flex 2 and ColdFusion MX to build an image upload tool. In Flex, I'm using the URLRequest.upload() method to send a file to a cfm page.

Everything works perfectly until I try to upload a large number of files... The upload fails with an I/O error (see attached image) when the upload reaches the mid-50mb range or around 40 or so images. Ironically, the error always occurs at exactly 60 seconds into the upload... The max amount of time you can set the scriptTimeLimit max to!

Does anyone have any suggestions as to what might be going on?! Can a Flex script really only "process" for a max of 60 seconds?!

If it's of any help, the error doesn't happen in IE. It only gives us problems in FireFox (on windows) and problems with Safari or FireFox (on a mac).

ANY help would be appreciated! Thanks!

dr_zeus
04-27-2007, 07:21 PM
Yes, a script may only run for 60 seconds. That's a GOOD thing. You don't want the user to think that his system has frozen or something like that. Rather than uploading the files all at once, you should try to send a file, or maybe several, every frame or at least after a short delay. This will ensure that Flash Player won't freeze up on you, and you can update a progress bar of some sort so that your users will understand that something is happening.

Some psuedo-code as an example:

this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

private function enterFrameHandler(event:Event):void
{
this.uploadNextImage();
}

In this case, since you're getting an IOError rather than a player-level timeout dialog, you might need to work things a bit differently. Perhaps, you can upload the next image after you receive the event that the first image has finished. It would work in a similar manner to the example above except rather than the ENTER_FRAME event, you'd listen to a COMPLETE event from whatever class is handling the upload.