Johnny Kewl wrote:

----- Original Message ----- From: "Dave" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, October 07, 2008 11:03 PM
Subject: video/x-flv mime-mapping does not for Tomcat 5.5


we are using JBoss4.0.5. For flash video, we added

<mime-mapping>
<extension>flv</extension>
<mime-type>video/x-flv</mime-type>
</mime-mapping>

in tomcat conf/web.xml.

Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType returns "application/octet-stream", not "video/x-flv". Could you please help me?

I think Johnny's talking nonsense. But he's gone watch the debate, so I can probably get away with this.

Seriously, my guess :
I think you are confusing what happens on the way in (browser -> Tomcat) with what happens on the way out (Tomcat -> browser). The <mime-mappings> above probably only tell Tomcat what it should put in the HTTP response headers as "Content-type" when *returning* such a file to the browser.

On the way in, on the other hand, it is the browser that "guesses" the file type, and sends this to the server as part of the POST data. The server then just picks up what the browser says. If the browser doesn't know what the file is, it will probably in this case determine that the file is "binary" (not text), and since it does not know a precise type, it will send it with a type "application/octet-stream", which is the standard safe Mime type for any binary file you do not really know the type of.

Try the following : somewhere in your browser or your operating system, there must be a way to specify that "..for this file type .. do this". Do that for this file type, and then try to resubmit the same file to your Tomcat application and see what it says.

If it then works, unfortunately that is only a solution for your own browser and your own workstation. In order to determine the file type correctly no matter which browser it comes from, you probably have to do it in your application.

There exist standard modules/add-ons/libraries/subroutines in most programming languages, that can make guesses at the mime type of a file. Unfortunately in Java I personally don't know what it would be.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to