• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Name equals Null for input type file  RSS feed

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Below is my code to upload a file :


When I do in my Servlet, it prints " filename null " on the screen. The file mapping is right.

Please advise.

Thanks..

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getParameter() methods do not work with multi-part requests.
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
I'm extremely sorry for the inconvenience.

I need to upload a file on my jsp, this file should always contains 7 digits numbers, one on each line but might contain something else by human mistake.
So, if getParameter() doesn't work in MultiPart request, then can I remove this "enctype="multipart/form-data" attribute from the form tag.

Could you please give some advice.

Thanks a lot.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JspFaq entry on file uploading.
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bulls-eye!

Thanks a lot.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!