Yordan Yanakiev
Yordan Yanakiev

Reputation: 2604

Flex : save a resource from url to hard drive?

How do I save a resource like "something.rar" from the web, like when it is located on a regular web page?

Upvotes: 1

Views: 142

Answers (2)

Lee
Lee

Reputation: 13542

use FileReference.download(). There is a complete example shown at the adobe doc page.

Here's the basic idea:

var downloadURL:URLRequest = new URLRequest("http://www.[yourDomain].com/SomeFile.pdf");
var file:FileReference = new FileReference();

// add listeners to `file` to catch errors, handle progress, etc
// (see adobe docs for a complete example of the possible listeners)

file.download(downloadURL, fileName);

Upvotes: 3

cwallenpoole
cwallenpoole

Reputation: 81988

You're looking for the FileReference class. Here's a tutorial.

Upvotes: 2

Related Questions