Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > AIR (Apollo)

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-28-2008, 02:10 PM   #1
CaroD
Registered User
 
Join Date: Feb 2006
Location: Milan
Posts: 10
Default Download files from server and save to user's computer - possible?

Our client's website has a download area where users can log in and download images and 3D models in various formats of their products. I've been asked about the viability of porting this download area to an AIR application. Is this possible? Can an AIR application access files on a remote server and save them to the user's computer (in a directory specified by the user)? I've read the AIR white paper on security but am still unclear as to whether this can be done and how.

Thanks in advance!
CaroD is offline   Reply With Quote
Old 04-30-2008, 01:07 AM   #2
evride
2006 Man Of The Year
 
evride's Avatar
 
Join Date: Mar 2007
Posts: 880
Default

yes its possible.

use the URLLoader to load the necessary file in URLLoaderDataFormat.BINARY.
once that has loaded. just use the File and FileStream classes to save the file.


ActionScript Code:
var byteLoader = new URLLoader(); byteLoader.dataFormat = URLLoaderDataFormat.BINARY; byteLoader.addEventListener (Event.COMPLETE, onBytesLoaded); var fileRequest = new URLRequest ("image.jpeg"); byteLoader.load (fileRequest); function onBytesLoader(evt:Event){ var myFile:File = File.documentsDirectory.resolvePath("images/image.jpeg"); var myFileStream:FileStream = new FileStream(); myFileStream.open(myFile, FileMode.WRITE); myFileStream.writeBytes(evt.target.data, 0, evt.target.data); }


Am i the only person on here that answers AIR questions? lol
__________________
I've curiosity on my side.
evride is offline   Reply With Quote
Old 05-01-2008, 01:26 PM   #3
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 524
Send a message via AIM to xwielder
Default

Quote:
Originally Posted by evdog View Post
Am i the only person on here that answers AIR questions? lol
No.
xwielder is offline   Reply With Quote
Old 05-01-2008, 04:48 PM   #4
evride
2006 Man Of The Year
 
evride's Avatar
 
Join Date: Mar 2007
Posts: 880
Default

Quote:
Originally Posted by xwielder View Post
No.
Ha.
__________________
I've curiosity on my side.
evride is offline   Reply With Quote
Old 05-02-2008, 09:03 AM   #5
CaroD
Registered User
 
Join Date: Feb 2006
Location: Milan
Posts: 10
Default

Thanks a million, that's exactly what I was looking for.
CaroD is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save XML files with PHP to a server 4dplane ActionScript 3.0 2 05-29-2007 06:01 PM
Save "Shareobject" data in a server without Flash Media Server. Urtzo ActionScript 2.0 4 05-15-2007 01:18 PM
[Q] How to Save Text File in Flash??? CyanBlue Other Flash General Questions 1 02-15-2007 09:22 AM
saving captured video from computer camera to server shizny Flash Media Server 3 09-18-2006 03:04 PM
getURL to download .xls files? cardiel ActionScript 2.0 1 05-24-2006 04:28 PM


All times are GMT. The time now is 07:56 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.