Redirect to new URL after dragging&dropping a file
I want to include a container on an aspx site that al开发者_Go百科lows drag&drop of files. The behavior that I would like to implement is the following:
After a user drops a file on a container I would like to redirect him to the url with the form to upload documents, but with the path filled out for him. This way he only has to choose name, document type ans so on.
What is the best approach for doing this? Is there a Library that does something similar?
Thanks
This is a HTML5 functionality not all browsers implement. You may achieve this in chrome or with Google Gears but there is no library as far as I know.
If you wish to use only javascript and asp.net as the backend, I'm afraid you can't do what you described since you have no direct access to the filesystem and you cannot dispatch files from one page to the other in such a way.
However, modern browsers do support HTML 5 file drag and drop into browser (and you could support older browsers with a Flash solution). Therefore, you could create a pseudo upload form. What I mean is that while you display a field to the user that mimics the file upload input (as in it looks like one), instead you have the file uploaded to the server when it was dropped and then redirect the user to the form which has the pseudo file input field.
Also, I'd recommend a more natural solution where the user can see the form and then has the ability to drop files on a certain area (like in gmail for example) and for backward compatibility, you could include a simple file input.
You can check the following libraries/plugins out:
http://www.plupload.com/
http://plugins.jquery.com/plugin-tags/html5-upload
精彩评论