开发者

Flex : save a resource from url to hard drive?

开发者 https://www.devze.com 2023-04-10 20:49 出处:网络
How do I save a resource like \"someth开发者_开发技巧ing.rar\" from the web, like when it is located on a regular web page?use FileReference.download().There is a complete example shown at the adobe d

How do I save a resource like "someth开发者_开发技巧ing.rar" from the web, like when it is located on a regular web page?


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);


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

0

精彩评论

暂无评论...
验证码 换一张
取 消