how to upload all of the contents in a folder from jsp

别等时光非礼了梦想. 提交于 2019-12-11 22:19:46

问题


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


来源:https://stackoverflow.com/questions/4115391/how-to-upload-all-of-the-contents-in-a-folder-from-jsp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!