开发者

Uploading the contents of a directory in JSP

开发者 https://www.devze.com 2023-03-14 17:31 出处:网络
I\'m deve开发者_运维技巧loping a JSP application, and I want to be able to upload the contents of a directory to the server. So the user will select the directory he wants to upload, and somehow all i

I'm deve开发者_运维技巧loping a JSP application, and I want to be able to upload the contents of a directory to the server. So the user will select the directory he wants to upload, and somehow all its contents will be uploaded.


Can't be done with regular HTML/Javascript, you have to use either Java or Flash.


There is no support for this in HTML (only uploading of a single file) so there is nothing you can do in your JSP. If you want to do this in java you will have to have something client side, like a signed Applet or a jar that the user downloads and runs.


Looks like it's time for a Framework! Struts2 can handle this type of jobs well and is easy to start with. Here you can take a look at a File Upload sample.


As said, there is no way to do this in JavaScript/HTML.

If you do not want to use a Java Applet (they are clunky and your users may not have Java installed), you can let people upload a zip file and extract it on the server (there is support for this in the Java standard API). Both Windows and Mac OS allow the clients to zip a folder by right-clicking.

0

精彩评论

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