Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-25-2004, 09:04 PM #1
- Join Date
- Feb 2004
- Thanked 0 Times in 0 Posts
Having problem with <input type="file"..
I have the following form element in my jsp page:
<form method="post" enctype="multipart/form-data" action="<%=someUrl%>">
<input type="file" name="userfile">
which allows a user to select a filename by clicking on the browse button.
In my servlet, I am trying to get the name of the file selected by the user as follows:
String sFileName = request.getParameter("userfile");
When I print out sFileName, it prints null. Does anyone have any idea or suggestion how to get this user entered filename in the servlet?
Thanks a lot!
03-29-2004, 08:16 AM #2
- Join Date
- Jun 2002
- Thanked 215 Times in 212 Posts
When form encoding is "multipart/form-data" which is required for upload forms, you will not be able to retrieve form data normally (using request.getParameter)
Have you heard of JspSmartUpload component?Glenn
Tower of Hanoi Android app (Ad-FREE!)
Tower of Hanoi Android app (FREE!)
Tower of Hanoi Leaderboard
vBulletin 5 Floating Bar extension
vBulletin 5 Slideshow extension
vBulletin 5 Quote Selected Text extension
vBulletin 5 Profile Preview Tooltip extension