Controller.File Method
Include Protected Members
Include Inherited Members
Creates a FileContentResult object.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
Name | Description | |
---|---|---|
File(Byte[], String) | Creates a FileContentResult object by using the file contents and file type. | |
File(Stream, String) | Creates a FileStreamResult object by using the Stream object and content type. | |
File(String, String) | Creates a FilePathResult object by using the file name and the content type. | |
File(Byte[], String, String) | Creates a FileContentResult object by using the file contents, content type, and the destination file name. | |
File(Stream, String, String) | Creates a FileStreamResult object using the Stream object, the content type, and the target file name. | |
File(String, String, String) | Creates a FilePathResult object by using the file name, the content type, and the file download name. |
Top
The File() helper method provides support for returning the contents of a file. The MediaTypeNames class can be used to get the MIME type for a specific file name extension.
A Visual Studio project with source code is available to accompany this topic: Download.