You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Wilcox, Mark" <Ma...@webct.com> on 2003/09/23 00:37:31 UTC

fileupload question

How can I set the mime-type of a file during fileupload?
 
thanks,
mark

	 

	 


Re: fileupload question

Posted by Michael Becke <be...@u.washington.edu>.
Hi Mark,

If you are using the MultipartPostMethod it is specified in the 
FilePart constructor.  For example, if you were uploading a gif it 
might look something like:

MultipartPostMethod post = new MultipartPostMethod("/somepath");
File f = new File("/tmp/test.gif");
post.addPart(new FilePart("parameterName", "test.gif", f, "image/gif", 
null));

There is also some code in the contrib source directory that handles 
content types based upon file extension.  It may come in handy, but is 
not required for this to work.

Mike

On Monday, September 22, 2003, at 06:37 PM, Wilcox, Mark wrote:

> How can I set the mime-type of a file during fileupload?
>
> thanks,
> mark
>
> 	
>
> 	
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org