hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf Scheidt <Olaf.Sche...@werum.de>
Subject AW: [REDDOXX Spamfinder] Re: AW: MultipartEntityBuilder with special char in filename
Date Thu, 23 Apr 2015 08:34:10 GMT
Hi Oleg,

thanks for your reply. Problem is solved.
It was the problem of the opensource upload servlet. 
I have written my own Servlet and now it works. 
I updated tomcat to the newest version, so I can use getParts(), which is much easier to handle.

Regards,

Oliver
 

-----Urspr√ľngliche Nachricht-----
Von: Oleg Kalnichevski [mailto:olegk@apache.org] 
Gesendet: Mittwoch, 22. April 2015 12:45
An: HttpClient User Discussion
Betreff: [REDDOXX Spamfinder] Re: AW: MultipartEntityBuilder with special char in filename

On Tue, 2015-04-21 at 16:18 +0000, Olaf Scheidt wrote:
> Hi Community
> 
> How can I send a thumbail with percent char in Filename e.g. a%02.jpg. 
> Percent is removed at the destination. a%02.jpg=>a02.jpg
> 
> File filename=new File("/tmp/a%02.jpg"); HttpPost post = new 
> HttpPost(url); MultipartEntityBuilder mpe = 
> MultipartEntityBuilder.create(); 
> mpe.setCharset(Charset.forName("UTF-8"));
> mpe.addBinaryBody("fileData",filename,ContentType.create("image/jpeg")
> ,filename.getName());
> post.setEntity(mpe.build())
> 
> Regards,
> 
> Oliver

Oliver

Percent sign should be legal for file names. You can try encoding the file name with q-printable
or base64 codecs but there is no guarantee the server would be able to decode it correctly.

For more complex scenarios involving MIME consider using Apache Mime4J instead of HttpMime.

https://james.apache.org/mime4j/

Oleg 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

Mime
View raw message