2

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

user309094
  • 21
  • 2

1 Answers1

4

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

Nizam
  • 5,698
  • 9
  • 45
  • 57
Umesh
  • 1,242
  • 1
  • 13
  • 24
  • Nizam..does this code really works? I am using Flash Builder 4.5, I get the following error "Type was not found or was not a compile constant:File" Can you please help on this? Thanks – FlexyBoz Mar 19 '14 at 08:36