• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem using oreilly,multipart-request with Websphere 5.1

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using WSAD 5.1 and I am using the oreilly.MultipartRequest to upload images from my HTML page to the servlet. However, the files do not get uploaded. If I try to do a request.getParameter() on any other form attribute it returns a null. I read that this has been a bug in the versions previous to Websphere 5.0.1.
Can anyone tell me if there is a work around for this problem.
Thanks in advance for your help!!!
-DC.

My HTML looks like this:
<form method=post action="UploadImageRequestHandler" ENCTYPE="multipart/form-data" name=form1 onSubmit="window.close();">
<input type=file name=filesent onChange="DoPreview()">
</form>

the servlet does something like this:

public void doPost(HttpServletRequest oRequest, HttpServletResponse oResponse) throws ServletException, IOException {
MultipartRequest mp = new MultipartRequest(oRequest, "C:\\data\\");
}
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U have to check if the object is an instance of multi part request and take appropriate action.....else request.getparameter will always return null
 
DC DC
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried checking whether the object was an instance of Multipart Request:

MultipartRequest mp = new MultipartRequest(oRequest, "C:\\data\\");
if(mp.getClass().equals("MultipartRequest")) {
String height = mp.getParameter("Height");
System.out.println("It probably uploaded the file" + height);
}

But it seems to freeze there forever without doing anything.
I am not sure I did the right thing. I am unable to load any files into the directory. Please let me know if there is anything else I can try.
Thanks in advance for your help!
DC.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There surely must be better alternatives than that library, too. I read it to figure out how to do multipart in my own server. It's not very pretty code. Maybe it was a good design in C once, translated to Java.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stan James:
There surely must be better alternatives than that library, too. I read it to figure out how to do multipart in my own server. It's not very pretty code. Maybe it was a good design in C once, translated to Java.



I've used both but prefer this one.
http://jakarta.apache.org/commons/fileupload
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic