Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the valid content types for Controller.File()?

I'm using MVC 4 in Visual Studio. I want to know how to create a file with the Controller.File() method. I understand I need to pass a file type. What are the valid file types? I'm not seeing this in the documentation (http://msdn.microsoft.com/en-us/library/dd492492(v=vs.108).aspx).

Example code:

return File(answers, "txt",filename);

Is there a list of content types that someone can reference me? I need to know format of the "txt" argument (or whatever I'm supposed to be putting there) basically (e.g. "txt" or ".txt" or "text/html" or "*.txt", etc.).

like image 657
levininja Avatar asked Aug 04 '26 20:08

levininja


1 Answers

Those are mime types.
There are extensive lists of them all over the internet, including the official list from IANA.

like image 98
SLaks Avatar answered Aug 06 '26 09:08

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!