This project has moved and is read-only. For the latest updates, please go here.
2

Closed

Mime Type information appears missing / not provided

description

Hi guys,
 
awesome little tool this ... any chance that mime types can be sent to the server with the document or some mechanism for identifying mime types accurately provided ?
I am basically using this but modifying the httphandler to dump the data directly to a database, without the mimetype i can't set the mime type prior to returning the file on the way out, thus leaving any calling client app / browser in the dark as to what the file is.
 
What are your thoughts on simply using the octet stream mime type for everything ... not ideal from my point of view but doable.
Closed May 1, 2012 at 9:16 AM by mpost
MIME type can be determined server side.

comments

mpost wrote Jun 7, 2011 at 12:33 PM

When the file is uploaded, it's available for processing on the server.
You can easily detect the mime type on the server and store it in your database for example.

http://stackoverflow.com/questions/58510/using-net-how-can-you-find-the-mime-type-of-a-file-based-on-the-file-signature

jcb871 wrote Aug 30, 2011 at 6:20 AM

Hi mpost,

Thank you for this very useful component.
I also need to get correct MIME types in server side.
Using above approach I am getting "application/octet-stream" for all the file types.

Could you please provide some alternatives?
I don't want to rely on extension of the file for checking the file.

wrote Aug 30, 2011 at 6:23 AM

mpost wrote Aug 30, 2011 at 8:19 AM

I agree with this: http://forums.silverlight.net/p/94957/217535.aspx
"MIME is an internet http thing and doesn't apply to OpenFileDialog."
There's no one MIME type for a file. The MIME type can be configured in IIS and you can always set a custom MIME type. You should determine the mime type server side. And make your own logic for handling this correctly.

You can try using the solution here:
http://stackoverflow.com/questions/6504143/set-content-type-of-file-in-silverlight-savefiledialog

jcb871 wrote Aug 30, 2011 at 9:10 AM

Hi,

Thanks for the prompt reply :)
But I have already tried the "FindMimeFromData" method and it always returns "application/octet-stream".
And I couldn't find any other solutions from net other than checking the extension.

Please let me know if there are any other solutions.

wrote May 1, 2012 at 9:16 AM

wrote Feb 21, 2013 at 11:48 PM

wrote May 16, 2013 at 11:31 AM