0

I have a requirement to select a file from fileReference.browse(), but I want to browse a file to specific location say D:\Dir\file instead of the OS specific (The dialog box is native to the user's operating system).

Is it possible?

Thanks in Advance-

1 Answer 1

1

Since you're using File, I'm assuming you're using the Air runtime. To do this, you just need to set the path in the file constructor before you browser; like this:

var file:File = new File(somePath);
file.browse();

The only problem with this is that if you set it as an absolute path (like say, "c:\Users\SomeUser"), it might not work on Macs or Linux computers. Be sure to use some of the File class' built in static properties when you can, like these:

  • File.applicationStorageDirectory—a storage directory unique to each installed AIR application
  • File.applicationDirectory—the read-only directory where the application is installed (along with any installed assets)
  • File.desktopDirectory—the user's desktop directory
  • File.documentsDirectory—the user's documents directory
  • File.userDirectory—the user directory
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.