You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by sudip shrestha <su...@gmail.com> on 2006/11/01 20:50:04 UTC
ContentType in FilePart
Trying to upload a file with applet using HttpClient:
By looking at Class *
org.apache.commons.httpclient.methods.multipart.FilePart and *its
Constructors such as
*FilePart<http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/FilePart.html#FilePart%28java.lang.String,%20java.io.File,%20java.lang.String,%20java.lang.String%29>
*(String <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html> name,
File <http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html> file,
String <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html>
contentType,
String <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html>
charset),
looks like I have define the content-type beforehand....
Is there a way I can detect the content-type of the file I am trying to
upload with some external libraries (besides using some sort of extension
map that maps extensions to the mime-type)?
Re: ContentType in FilePart
Posted by Roland Weber <ht...@dubioso.net>.
sudip shrestha wrote:
> Is there a way I can detect the content-type of the file I am trying to
> upload with some external libraries (besides using some sort of extension
> map that maps extensions to the mime-type)?
None that I know of. But if it doesn't matter to your application what
kind of content you are uploading, I suggest to leave it as null. That
will set the default content type "application/octet-stream".
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org