kpjj31 used Ask the Experts™
I want to open and save a file that is being returned in remote call result. I have no problem opening the url with navigateToURL. The result is in string format. For some reason I can not download the file when it is returned in result event.
private function init():void{
fileRef = new FileReference();

private function getCertificateResult(event:ResultEvent):void{
navigateToURL(new URLRequest(event.result.FILEURL)); works; does not work

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Can you put more details about what you exactly want to do on result event with the File URL?

Do you want to open that file in your Flex application and want to allow user to make changes to that file?
or do you want to load that file in memory and make changes?
After that do you want to save back that file on server?

May be you can brief it in your way


There is an option to open or save the file. Opening the file outside of the application is working. I want the user to be able to save the file to their local directory as  well. Which I have done before, but for some reason it does not work when the file string is returned in  aevent result.
Yes that's true! it should work this way.

I may sound doubting, but can you please check your code as below:

private function getCertificateResult(event:ResultEvent):void
// navigateToURL(new URLRequest(event.result.FILEURL)); works URLRequest(event.result.FILEURL)); // check if you are assigning urlReq with result's file url


Still not working. It does not even work when I put a static url string in the URLRequest. I even tried calling a seperate function from my result passing the event.result.FILEURL.


It only seem to work when it is triggered from a click event, becuase i put in my init() function when the page is loaded with a static document and no luck.
u r right... flash doesnt allow this..

for security reasons, if u want the download function, it can only be called on user click..

simillary you cannot simulate an upload from users system. the browse only responds when there is a click from user... its in the flash's security sandbox
Yes that's correct! Filereference's download and upload operations can only be triggered on user interaction events.

In this situation either you have to use navigateToURL or you can use a server side script, and pass that URL to server script that will echo that file in response so that it'll download the file.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial