views:

322

answers:

1

I'm deploying a small application with Adobe Air. My application will do batch upload from filepath which stored in a text file.
For example, in a text file name "list.txt", there is a string "C:\myfiles\IMG_0001.JPG". Now I want to upload this image file, keep tracking of upload progress :-<
I want to use FileReference to get the upload progress, but I don't know how to import from file's path. I also wonder how to use FileReference to upload this file without prompting a dialog for user to select file.
Thank you so much :)

+2  A: 

Try the following. I have done a file upload without dialog box using following code.

var uploadURLs:URLRequest = new URLRequest("Your upload URL Here");

var params:URLVariables=new URLVariables();

params.title = "Hello";//URL Parameters if there is any

uploadURLs.data = params;

uploadURLs.method=URLRequestMethod.POST;

file = new File("Path to File");

file.addEventListener(ProgressEvent.PROGRESS , updateProgress);

file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, doneUpload);

file.addEventListener(IOErrorEvent.IO_ERROR,fileError);

file.upload(uploadURLs);

Hope this helps

Umesh