Reputation: 1043
I'm trying to upload a file using ActionScript, which I can do quite easily if I get the file via FileReference.browse(), what I want to do though is get the file after it has been dragged and dropped into the window.
I've got the drag and drop working fine, and I can iterate through the files like so:
var dropFiles:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
for each (var file:File in dropFiles){
trace(file.url);
But how can I get these files across to FileReference.upload()? Hoping someone can help me out! Thanks!
Darren.
Upvotes: 1
Views: 180
Reputation: 8033
If you have the URL, can't you just load it in with loader.load(new URLRequest(url));
?
This post might help you if you still have trouble: http://www.senocular.com/flash/tutorials/dragdropimageviewer/
Upvotes: 1
Reputation: 3731
flash.filesystem.file
extends flash.net.FileReference
. So you can do
var dropFiles:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
for each (var file:File in dropFiles){
file.upload(...);
Upvotes: 1