Skip to main content
January 10, 2013
Question

Why doesn't AS3 FileReference Download Work in IE/FF (Works fine in Chrome)

  • January 10, 2013
  • 1 reply
  • 2941 views

I am generating an Excel file with Java on the back-end and it seems to work just fine in Chrome but for whatever reason it doesn't in FF/IE. I have the very latest of Flash in each browser listed from this site: http://helpx.adobe.com/flash-player/kb/find-version-flash-player.html

I'm sending XML to the server, it is generating the Excel and sending it to the Flash. I'm performing the export by doing the following:

private var _fileRef:FileReference;

private function exportReport(e:MouseEvent😞void
{      
    _fileRef
= new FileReference();
    _fileRef
.addEventListener(Event.COMPLETE, excelExportCompleteHandler);
    _fileRef
.download(new URLRequest("exportReport"), "report.xlsx");

   
function excelExportCompleteHandler(e:Event😞void {
        trace
('complete');
   
}
}

There are no error messages from Java/Flash. The browse popup comes up and I save the file the same in IE/FF as I do in Chrome. the trace('complete') is executed every time in every browser but the file only shows up when using Chrome.

I also searched my filesystem and found temporary internet file shortcuts with the name of the file I was trying to download so it's as if it started the download but didn't finish it for some reason. The location of those files is AppData\Roaming\Microsoft\Windows\Recent Items

This topic has been closed for replies.

1 reply

sinious
Legend
January 10, 2013

Try adding in the full URL to the URLRequest rather than a relative server path (exportReport -> http://server/path/exportReport). Also check the other events for clues, ProgressEvent, SecurityErrorEvent and of course IOErrorEvent.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html#download()

Chrome tends to be a version behind here and there on the Flash plugin version. Not all the time but sometimes. It could be something WebKit is auto-resolving. If so you can try another WebKit browser like Safari to verify.

January 10, 2013

Hi sinious, I tried full URL and no change.

I tried all events available for FileReference to no avail, I then looked more carefully at the Event.COMPLETE handler and noticed the following message(it didn't show up in the IO Error handler)

Left hand side is a successful download, right hand side is not.

Looks like it's having trouble with those three attributes showing <exception thrown by getter>. I will continue looking into Error #2038: File I/O Error in the meantime but if anyone has any ideas it would be greatly appreciated. I haven't found anything useful searching on this error for the last hour.

Inspiring
January 11, 2013

Could it be, that your whole process (sending the xml, generating the xslx, downloading the xslx) takes longer than 60 seconds?

If so, look at this list of default KeepAlive Timeouts of various browsers. IE has a default of 60 seconds.(Chrome 300).