How to send an image from desktop(client) to server & vice versa
I have a web page, by clicking on a Button
- a file browser dialog box opens (it should be able to access the client's system)
- choose a
jpg/gif/any image file
and click OK to send - send it to server
via AJAX
- once the image saved in serve开发者_如何学Gor, a confirm message appears and
- save image populated on client machine in dialog/another window
No. 3, 4 can do using Ajax and server side programmimg (java), but i am not very confident about 1, 2 & 5.
Please help...Thanks in advance
1 & 2 Use an HTML input tag of type file: <input type='file' id='uploadfile'>
. Alternativly if you don't mind using a little flash Uploadify is pretty cool. I', not sure what you mean by step 5. Do you want the uploaded image to be displayed somewhere on the active browser window?
- A standard file input.
- Better validate filetype on the server not client. You may use
accept
attribute, but there's no use from it in most browsers. - Use ajaxupload
- Send ajax response and handle it on the client side. Display the image in
img
, for example. - Not sure. Why do you want to save it when the user just uploaded it from his machine?
精彩评论