hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quan Qiu" <quan.qiu...@gmail.com>
Subject Re: Multipart post error
Date Fri, 03 Aug 2007 23:38:10 GMT
Hello James

Do you mind to share your codes of uploading files by adding a parameter on
the URL with a hidden field multipart form?

Thanks
Quan


On 7/9/07, James Norman <james.norman@gmail.com> wrote:
>
> Just an FYI for anyone who may run across this thread.  I just got it
> working, what I did was the recommended PartBase.setTransferEncoding(
> null ) as well as move an additional StringPart from the part array to
> a parameter on the URL.  There was a hidden field in the multipart
> form and I just moved it to the URL.  This way I had only FilePart
> parts in the multipart request.  Thanks to all for the help.
>
> -james
>
> On 7/5/07, David.Bantel@thomson.com <David.Bantel@thomson.com> wrote:
> > Sorry about that (sent before finished)
> >
> > As I was saying,
> > For our situation, we needed to set both:
> >
> > Partbase.setTransferEncoding( null ) AND
> > Partbase.setConentType(null)  for each part, then it worked.
> >
> > Hope that helps,
> > Dave
> >
> > -----Original Message-----
> > From: Bantel, Dave (TTA R&G)
> > Sent: Thursday, July 05, 2007 8:08 AM
> > To: 'HttpClient User Discussion'
> > Subject: RE: Multipart post error
> >
> > James,
> >
> > We had a similar issue with multipart posts - we were able to get it to
> > work using cURL (which we use for a legacy app), then we compared the
> > trace from both requests. For our situation, we needed to set both
> > Partbase.setTransferEncoding( null ) AND
> >
> >
> >
> >
> > -----Original Message-----
> > From: James Norman [mailto:james.norman@gmail.com]
> > Sent: Wednesday, July 04, 2007 5:16 PM
> > To: HttpClient User Discussion
> > Subject: Re: Multipart post error
> >
> > I was afraid that was the answer I would get.  I haven't done any packet
> > analysis for a while, what tool would you recommend for Windows?
> >
> > Also, are there any applications such as wget that would support
> > multipart posts?
> >
> > -james
> >
> > On 7/4/07, Oleg Kalnichevski <olegk@apache.org> wrote:
> > > On Tue, 2007-07-03 at 22:32 -0600, James Norman wrote:
> > > > Hey All,
> > > > I'm not sure if anyone will be able to help with this but I figured
> > > > I'd try.  I'm trying to post multipart/form-data through httpclient
> > > > and I'm receiving the following exception on the server:
> > > >
> > > > java.io.IOException: Malformed line after content type:
> > > > Content-Transfer-Encoding: 8bit
> > > >
> > > > I get this in the stacktrace that is provided from the response on
> > > > the server.  I don't have access to code that runs on the server and
> >
> > > > it just happened to be running java and printed the stack trace.  It
> >
> > > > also appears to be running some proprietary multipart server code,
> > > > this was in the stack:
> > > > at
> > > > com.mstr.sound.MultipartRequest.readNextPart(MultipartRequest.java:2
> > > > 31)
> > > >
> > > > I have been successful uploading files with HttpClient and Tomcat
> > > > locally, but not on this remote server.
> > > >
> > > > I found this thread from someone who had the same exception:
> > > > http://mail-archives.apache.org/mod_mbox/jakarta-httpclient-user/200
> > > > 512.mbox/%3C43A1F4C6.5050401@carosys.com%3E
> > > > Which had a recommended solution to
> > > > Partbase.setTransferEncoding( null ); However this did not fix the
> > > > issue and the server started returning NPEs.
> > > >
> > > > My question is this, the file upload works fine through Firefox and
> > > > IE but does not work through HttpClient, does anyone have any
> > > > suggestions I can try.  I'm also open to any workaround, even
> > > > shelling to another program to get this working.
> > > >
> > > > Thanks for any help you can provide.
> > > >
> > >
> > > James,
> > >
> > > Here's what you may want to try:
> > >
> > > (1) capture packets generated by IE or Firefox using a traffic
> > > analyzer or a proxy
> > > (2) capture packets generated by HttpClient
> > > (3) compare the composition of the multipart requests
> > > (4) try to eliminate differences in the generated requests by tweaking
> >
> > > HttpClient's configuration / subclassing MultipartRequestEntity.
> > >
> > > Hope this helps
> > >
> > > Oleg
> > >
> > > > -james
> > > >
> > > > --------------------------------------------------------------------
> > > > - To unsubscribe, e-mail:
> > > > httpclient-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > > httpclient-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > httpclient-user-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message