Hi to all.
SWFUpload is a great tool to provide multiple uploads to servers.
I am using it in a extjs application (Ext.ux.SWFUploadPanel)
This works quite good. Now i am thinking over deploying our application with a flex browser which means the html/extjs application is displayed by the flex application. Flex/Air provides capability of drag drop from desktop.
Now my question. Is it possible to add a files manually to the queue without using the flash button which opens the file select dialog.
I checked the SWFUpload.as shipped with the 2.0.1 release and found the following code part in Line 662 (private function Select_Handler)
this.file_queue.push(file_item);
Why not exclude the part into an separate private function which also handles the event for this. This function could be assigned to the external interface and this would make it possible to call it from javascript/flex.
Implementing this would make sense as some browsers support the new html5 Drag&Drop. This would make it possible to add files to the upload panel over the button and via drag and drop.
Maybe a moderator of this forum or a swfupload professional can give me feedback on this if it is possible or if there are security issues or restrictions which prepends us from doing this.
Thanks everyone for feedback and input on this.
Robert
February 16, 2010 - 3:47pm
I use a Java applet and javascript to enable file queueing through drag and drop. Unfortunately I can't (or don't know how to) push the list of files to SWFUpload. The described solution would certainly be of good use to me.
/LF
February 16, 2010 - 4:47pm
The Flash Player's security model will not allow this. This is a good thing. You don't want any developers pulling files from your computer when they feel like it; without your consent.
Flash requires the user to click the movie (pointless security) which opens a file selection dialog. The user must choose the files to send (good security) and then you as the developer have limited access to the file (size, name, contents).
/rant
After you (as the developer) have access to the file's contents all the Flash Security is just a hassle. They have security to prevent certain kinds of uploads but a malicious entity doesn't care if it looks like an HTTP upload so long as they get the data. The restrictions just make life difficult for the average dev.
For the malicious script, once I have convinced you to choose a file then you have lost. All the other security will not block me from getting your data.
For a normal developer all the security just makes Flash less useful as a development platform.
March 5, 2010 - 5:10am
Thanks for clarifying this. As always the issue is balancing security and user experience. I guess Flash could allow file pulling with a big "OK/Cancel" message, but that's just fantasy. (A little sad that my drag-and-drop feature was stopped by this..)