开发者

Uploading multiple files using jsp

开发者 https://www.devze.com 2023-04-08 08:38 出处:网络
I am creating a website where the users can upload photos,videos and also write or create posts.It\'s almost like a blog.I am using JSP.I have used \"multipart/form data\".But I am facing a problem.Wh

I am creating a website where the users can upload photos,videos and also write or create posts.It's almost like a blog.I am using JSP.I have used "multipart/form data".But I am facing a problem.Whenever the user is clicking on the submit button,all the photos and videos cannot be uploaded at the same time.Besides,since I am using "multipart/form data" I cannot retrieve the values by request.getParameter() in the next page.So what should I do?I searched across many websites and found a code on uploading which in开发者_如何学编程cluded Disk and Iterator interfaces.But I am having problem in resolving them.Someone help me please.


You cannot use request.getParameter() with a form having "multipart/form-data". Use FileUpload API (Apache commons).


Whenever the user is clicking on the submit button,all the photos and videos cannot be uploaded at the same time.

This cannot be true. This problem is caused by something else. Perhaps you're using JavaScript to submit the form on a click/change of the file field, or you are misinterpreting the process at the server side.


Besides,since I am using "multipart/form data" I cannot retrieve the values by request.getParameter() in the next page.So what should I do?

Use the same API as you have used to parse the uploaded file (you did use one, right?). That very same API should be able to give you those parameters back from the multipart/form-data body.

See also:

  • How to upload files to server using JSP/Servlet?
0

精彩评论

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

关注公众号