Solved

FileUpload: Content-Type disparity between Firefox & IE

Posted on 2006-11-01
3
404 Views
Last Modified: 2008-02-01
I am creating a file upload utlity very similar to this one: http://authors.aspalliance.com/das/tutorial/test/fileupload2.aspx.

If I upload a simple .txt file the "Content-Type" (FileUpLoad1.PostedFile.ContentType) differs between Firefox and IE:

IE displays "Content type: text/plain"
Firefox displays "Content type: application/save-as"

The problem is that we are going to be storing the files uploaded by the user into a DB and we need to save the content type so that we can stream it properly back to the browser when they go to download the file again from the DB.  With Firefox and IE returning different content types, I can only imagine this will cause problems down the line.

Is this by design? Or will this cause problems later on?
0
Comment
Question by:Mr_Snrub
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
ID: 17856071
Mr_Snrub,
1-This is a major difference between IE and FF and its by design.
2-you don't need to save the content type to enable streaming the files for downloads. you can easily force the file download using
Response.ContentType = "application/x-download"
Response.AddHeader("Content-Disposition", "filename=" & any_filename_includding_its_extension)

see this example here
http://www.asp101.com/samples/download_sample_aspx.asp

HTH
0
 

Author Comment

by:Mr_Snrub
ID: 17858035
Thanks, that's very helpful.
0
 
LVL 27

Expert Comment

by:Sammy
ID: 17859766
You welcome Mr

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
performance issue in asp web 5 33
Deploying to Azure 3 29
Expression Evaluater 3 27
C# LINQ ForEach() question 6 28
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question