Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:16:47+00:00 2026-06-08T21:16:47+00:00

My MVC-3 application has a file upload feature. The file content and content type

  • 0

My MVC-3 application has a file upload feature. The file content and content type are saved in database so that while trying to download, the correct file can be reencrypted.

Everything is working fine except that if the browser is Firefox 13 (13.0.1 I have), the content type of docx file is detected as text/plain instead of application/vnd.openxmlformats-officedocument.wordprocessingml.document.

I have checked that it works fine in IE. And now I am upgraded to Firefox 14.0.1. Its working fine too.

Now the question is, how can I determine the content type of a HttpPostedFileBase independent of browser?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:16:49+00:00Added an answer on June 8, 2026 at 9:16 pm

    Original Answer

    As I understand it, MIME types are not the most reliable thing.

    Personally I would ignore the browser-provided content type completely, and use server map based on FileName extension (not precise either, but at least similar to the experience in OS itself).

    After all, client can send you pretty much anything at all as a content type (dependning on the browser and, potentially, system).

    Mapping extensions to Content Types

    One option (as used by the question author) is to use entries in HKEY_CLASSES_ROOT:

    var key = Registry.ClassesRoot.OpenSubKey(extension, false);
    var value = key != null ? key.GetValue("Content Type", null) : null;
    var mime = value != null ? value.ToString() : string.Empty;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My MVC application has a simple file download controller action that downloads a file.
I have an mvc application that has been coded to use Windows authentication and
I am using a custom MVC application that has dependencies on SPring Batch as
I am creating an ASP.NET MVC application that has postcode lookup functionality. I capture
I have an ASP.NET MVC application that has one part where I dont really
The MVC application that I am building has a portion of the page (implemented
I have an MVC application. The model has a property that is a struct
I currently have a ASP.Net MVC web application that needs to upload large files
i have an asp.net mvc app that has a form that uploads a file.
I'm doing a MVC application where several Xml-files will be used (Every XML-file has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.