Java file upload
can i upload a file(image) without submitting the form..
Basically i want to create a webpage where a u开发者_如何学Goser can upload an image and preview it side by side but this should not submit my form.
i dont wanna use jquery
You can have two forms on the page. One to upload the image and other one for something else. Just don't nest them.
I've tried to implement this with AJAX but, if it's even possible, it would be a nasty hack. About the best you can do reasonably is to put the file upload form in an iframe, and after posting the file with AJAX, redraw the page with the image.
I think this is what you want But it uses PHP for sever side you can use what ever you want!
All you have to do is create a page which will handle the ajax call, which is saving the image and returning string "true" in case of succeeds. and for Java this (Handling Form-based File Upload with Java Servlet or JSP) should help you.
Check this one out ioncannon.net
You can try this .Also check
精彩评论