|
Prev: Eclipse and RCP
Next: Logger.getLogger question
From: Kenneth P. Turvey on 17 Jul 2008 15:53 I'm having some difficulty getting file upload to work. I'm using some sample code of questionable utility and I was hoping someone here could give me a hand. The basic problem is that I need to post to a servlet an image and some associated metadata. It should look just like it does when it is posted by the following web page: <html> <head> <title>Image Uploader</title> </head> <body> <form method="POST" enctype="multipart/form-data" action="http://www.squeakydolphin.com/ImageUpload/ImageUpload"> Category<input type="text" name="Category" /><br/> UserId<input type="text" name="UserId" /><br/> Image<input type="file" name="Image" /><br/> <input type="submit" /> </form> </body> </html> It is accepted as multipart data on the server end and that works fine. I just can't seem to get the client to produce the write output. Is there a class library I can use to ease getting this correct? Thanks for any help you can provide. -- Kenneth P. Turvey <kt-usenet(a)squeakydolphin.com> http://www.electricsenator.net I think the world is run by C students. -- Al McGuire
From: Arne Vajhøj on 17 Jul 2008 19:33 Kenneth P. Turvey wrote: > I'm having some difficulty getting file upload to work. I'm using some > sample code of questionable utility and I was hoping someone here could > give me a hand. > > The basic problem is that I need to post to a servlet an image and some > associated metadata. It should look just like it does when it is posted > by the following web page: > > <html> > <head> > <title>Image Uploader</title> > </head> > <body> > <form method="POST" enctype="multipart/form-data" > action="http://www.squeakydolphin.com/ImageUpload/ImageUpload"> > Category<input type="text" name="Category" /><br/> > UserId<input type="text" name="UserId" /><br/> > Image<input type="file" name="Image" /><br/> > <input type="submit" /> > </form> > </body> > </html> > > > It is accepted as multipart data on the server end and that works fine. > I just can't seem to get the client to produce the write output. Is > there a class library I can use to ease getting this correct? Use the Apache HttpClient package, classes HttpClient, PostMethod and MultipartRequestEntity ! Arne
From: Kenneth P. Turvey on 17 Jul 2008 20:35 On Thu, 17 Jul 2008 19:33:37 -0400, Arne Vajhøj wrote: > Kenneth P. Turvey wrote: >> I'm having some difficulty getting file upload to work. I'm using some >> sample code of questionable utility and I was hoping someone here could >> give me a hand. >> >> The basic problem is that I need to post to a servlet an image and some >> associated metadata. It should look just like it does when it is >> posted by the following web page: >> >> <html> >> <head> >> <title>Image Uploader</title> >> </head> >> <body> >> <form method="POST" enctype="multipart/form-data" >> action="http://www.squeakydolphin.com/ImageUpload/ ImageUpload"> >> Category<input type="text" name="Category" /><br/> UserId<input >> type="text" name="UserId" /><br/> Image<input type="file" >> name="Image" /><br/> <input type="submit" /> >> </form> >> </body> >> </html> >> >> >> It is accepted as multipart data on the server end and that works fine. >> I just can't seem to get the client to produce the write output. Is >> there a class library I can use to ease getting this correct? > > Use the Apache HttpClient package, classes HttpClient, PostMethod and > MultipartRequestEntity ! > > Arne Thanks. I'll check it out. -- Kenneth P. Turvey <kt-usenet(a)squeakydolphin.com> http://www.electricsenator.net I think the world is run by C students. -- Al McGuire
From: Lew on 17 Jul 2008 23:40 Arne Vajhøj wrote: >> Use the Apache HttpClient package, classes HttpClient, PostMethod and >> MultipartRequestEntity ! Also, <http://commons.apache.org/fileupload/> -- Lew
From: Kenneth P. Turvey on 18 Jul 2008 00:47
On Thu, 17 Jul 2008 23:40:17 -0400, Lew wrote: > Arne Vajhøj wrote: >>> Use the Apache HttpClient package, classes HttpClient, PostMethod and >>> MultipartRequestEntity ! > > Also, > <http://commons.apache.org/fileupload/> Yeah, I was already using fileupload on the server side. I got it working with HttpClient. Thanks for the help, both of you. HttpClient really makes this stuff much easier. -- Kenneth P. Turvey <kt-usenet(a)squeakydolphin.com> http://www.electricsenator.net I think the world is run by C students. -- Al McGuire |