Try this:

   // get the file extension
   String fileName = formFile.getFileName();
   // the mime type for this file
   String mimeType = servlet.getServletContext().getMimeType(fileName);
   // if we got one set it
   if (null != mimeType) {
     response.setContentType(mimeType);
   }
   // otherwise set a default
   else {
     response.setContentType("text/plain");
   }

   // otherwise output the file
   ServletOutputStream os = response.getOutputStream();
   os.write(formFile.getFileData());
   return null;

Works for us ... This way you leave it up to the container to tell you 
the mime type. You can also configure mime types in your web.xml 
deployment descriptor file.

Sean

Konstantina Stamopoulou wrote:
> Hi Alexander,
> 
> This is what I did after searching the archieves. I'm a little bit confused
> with the mime type (shouldn't "multipart/form-data " work for every type of
> file? it doesn't work for .jsps). I think I have to search more on this 
> one.
> 
> Thanx for the reply,
> Konstantina
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to