开发者

Upload files in JSP/Servlet

i know how upload files in jsp/servlet, i already use fileupload from apache, but i don't know how to return some status of the upload to the user, for example, actually when someone select the file to upload, they have to click in 'upload' button and just when the upload finish the jsp page redirect to the another page. I want they can see a percentage of how much will take to complete the upload operation.

i already implement a listener using fileupload, but i do开发者_运维百科n't know how to show this information to the user, 'cause just when the upload is finished that i can redirect to another jsp page.

Any ideas ?

Best regards, Valter Henrique.


That's not possible in combination with plain HTML <form> with <input type="file">. To the point, you've got to send multiple simultaneous requests. A form submit with file upload will namely block as long as the upload is in progress.

Your best bet is using JavaScript/Ajax and/or Flash. There are several free file upload components supporting a progress bar, like Uploadify and SwfUpload.

If your servlet is well written, you should be able to use it unchanged.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜