About getting the mime-type of a file:
http://www.netomatix.com/Products/DocumentManagement/MimeDetector.aspx

On Aug 13, 7:34 pm, Daniel Hölbling <[email protected]> wrote:
> Hi,
> currently I have a working file-download that is basically the following
> code:
>
> public void Get([ARFetch("id")] Document document)
> {
>     Context.Response.ContentType = document.BinaryFile.MimeType;
>     Context.Response.BinaryWrite(document.BinaryFile.BinaryData);
>     string encodedFilename = new
> HtmlHelper(Context).UrlEncode(document.FileName);
>     Context.Response.AppendHeader("Content-Disposition",
> String.Format("attachment; filename={0}", encodedFilename));
>     CancelLayout();
>     CancelView();
>     return;
>
> }
>
> The download works fine, my problem lies with the filename gets changed in
> Firefox. For example:
> "rescues advanced.xlsx" will be
> in Chrome: "rescues advanced.xlsx"
> in Firefox: "rescues+advanced.xlsx"
> in IE8: "rescued advanced.xls"
>
> This gets really bad with umlaut filenames (since the Site will be in german
> that's obviously a problem) where firefox will go from: "ernährung.xlsx" to
> "ern%c3%a4hrung.xlsx"
>
> Also IE8 sometimes just inlines text-files instead of downloading them
> (happened to me with a .patch file).
>
> Has anyone ran into similar problems to this?
>
> I'd also take any wisdom on where to get the MIME-Type from. I currently
> only accept a couple of formats so I'm using a hashtable to retrieve the
> appropriate one, but that just feels wrong.
>
> greetings Danielhttp://www.tigraine.at
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to