how to upload all of the contents in a folder from

2019-09-06 08:45发布

问题:

i'm trying to upload all of the contents in a folder to another folder in my server using jsp and servlets. I already got one FileUpload but as you may know i can only choose a single file. Is there some possible way to do this?? To be able to choose a folder instead of a single file from a jsp?

Thanks in advance

回答1:

First thing you need to realize is that JSP is just a Java based view technology which allows you to control the output of HTML/CSS/JS using Java. After all, it's just HTML/CSS/JS which ends up in the webbrowser. In HTML, there's no possibility to select a folder for upload. The HTML <input type="file"> simply isn't designed for that. JSP can't do much about it.

Your best bet is creating a Java applet utilizing JFileChooser which is set to folder selection. You can embed it in the JSP page the usual HTML way. There are several 3rd party applets available which you could just download/buy and embed it in the JSP, but unfortunately none of them is freeware.

  • MyUploader
  • Rad Upload
  • HTTP File Upload Applet
  • JavaPowUpload
  • JFileUpload