Posts Tagged ‘FileReference’

FileReference upload II

A few weeks ago I posted about some issues with the FileReference Events in combination with Anti-Virus Tools. Apparently there is another problem even without using such tools. If your upload bandwidth is very low, lets say less than 100 kbit/s or even worse if you are using a good old modem (56kbit/s) to connect to the internet, you might get into trouble handling the IOErrorEvent.IO_ERROR Event. You will get #2038 FIleIOErrors during an upload process on slow connections even though your upload is fine and the file is hitting the server correctly. Actually there is a correlation between the connection speed an the file size.
The bigger the files (>500KB) and the slower the connection the more often you’ll get an IOError.

I think even in AS3 times it’s sometimes better to reclaim good old AS1/AS2 times where error handling didn’t play a major role and just don’t listen to every error event that could occur.

FileReference upload & Anti-Virus Software

Lately I experienced some problems with FileReference upload while using Kapersky Anti-Virus Software. The software has a feature to scan HTTP traffic for viruses which btw. is enabled by default. It uses some kind of cache which forces FileReference Events to be inaccurately or not beeing dispatched at all. As there are even more Anti-Virus Tools and Firewalls out there having similar features you should be aware of this problems.

You will notice the first problem when you try to show the upload progress. The ProgressEvent.PROGRESS bytesLoaded property will provide the bytes in the cache instead of the actual uploaded bytes. As a result your progress display will shoot up to 100% immediately on a fast Computer.

Be also careful with the usage of DataEvent.UPLOAD_COMPLETE_DATA as it doesn’t get dispatched once in a while while using the HTTP traffic scanning. Basically I guess the returning data is absorbed by the proxy, which handles the Anti-Virus cache.

The last issue is very weird but apparently Event.COMPLETE is fired before the file is completly uploaded to the server, therefore the file is not available just after the COMPLETE event, in case you want to call a convert script or something similar right after the upload. My assumption is that the proxy generates an HTTP status code of 200 which triggers the flash event when the cache is filled.

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger