Controller.File Controller.File Controller.File Method

Definition

Overloads

File(Byte[], String) File(Byte[], String) File(Byte[], String)

Creates a FileContentResult object by using the file contents and file type.

File(Stream, String) File(Stream, String) File(Stream, String)

Creates a FileStreamResult object by using the Stream object and content type.

File(String, String) File(String, String) File(String, String)

Creates a FilePathResult object by using the file name and the content type.

File(Byte[], String, String) File(Byte[], String, String) File(Byte[], String, String)

Creates a FileContentResult object by using the file contents, content type, and the destination file name.

File(Stream, String, String) File(Stream, String, String) File(Stream, String, String)

Creates a FileStreamResult object using the Stream object, the content type, and the target file name.

File(String, String, String) File(String, String, String) File(String, String, String)

Creates a FilePathResult object by using the file name, the content type, and the file download name.

File(Byte[], String) File(Byte[], String) File(Byte[], String)

Creates a FileContentResult object by using the file contents and file type.

protected internal System.Web.Mvc.FileContentResult File (byte[] fileContents, string contentType);
member this.File : byte[] * string -> System.Web.Mvc.FileContentResult
Protected Friend Function File (fileContents As Byte(), contentType As String) As FileContentResult
Parameters
fileContents
Byte[]

The binary content to send to the response.

contentType
String String String

The content type (MIME type).

Returns

The file-content result object.

File(Stream, String) File(Stream, String) File(Stream, String)

Creates a FileStreamResult object by using the Stream object and content type.

protected internal System.Web.Mvc.FileStreamResult File (System.IO.Stream fileStream, string contentType);
member this.File : System.IO.Stream * string -> System.Web.Mvc.FileStreamResult
Protected Friend Function File (fileStream As Stream, contentType As String) As FileStreamResult
Parameters
fileStream
Stream Stream Stream

The stream to send to the response.

contentType
String String String

The content type (MIME type).

Returns

The file-content result object.

File(String, String) File(String, String) File(String, String)

Creates a FilePathResult object by using the file name and the content type.

protected internal System.Web.Mvc.FilePathResult File (string fileName, string contentType);
member this.File : string * string -> System.Web.Mvc.FilePathResult
Protected Friend Function File (fileName As String, contentType As String) As FilePathResult
Parameters
fileName
String String String

The path of the file to send to the response.

contentType
String String String

The content type (MIME type).

Returns

The file-stream result object.

File(Byte[], String, String) File(Byte[], String, String) File(Byte[], String, String)

Creates a FileContentResult object by using the file contents, content type, and the destination file name.

protected internal virtual System.Web.Mvc.FileContentResult File (byte[] fileContents, string contentType, string fileDownloadName);
abstract member File : byte[] * string * string -> System.Web.Mvc.FileContentResult
override this.File : byte[] * string * string -> System.Web.Mvc.FileContentResult
Protected Friend Overridable Function File (fileContents As Byte(), contentType As String, fileDownloadName As String) As FileContentResult
Parameters
fileContents
Byte[]

The binary content to send to the response.

contentType
String String String

The content type (MIME type).

fileDownloadName
String String String

The file name to use in the file-download dialog box that is displayed in the browser.

Returns

The file-content result object.

File(Stream, String, String) File(Stream, String, String) File(Stream, String, String)

Creates a FileStreamResult object using the Stream object, the content type, and the target file name.

protected internal virtual System.Web.Mvc.FileStreamResult File (System.IO.Stream fileStream, string contentType, string fileDownloadName);
abstract member File : System.IO.Stream * string * string -> System.Web.Mvc.FileStreamResult
override this.File : System.IO.Stream * string * string -> System.Web.Mvc.FileStreamResult
Protected Friend Overridable Function File (fileStream As Stream, contentType As String, fileDownloadName As String) As FileStreamResult
Parameters
fileStream
Stream Stream Stream

The stream to send to the response.

contentType
String String String

The content type (MIME type)

fileDownloadName
String String String

The file name to use in the file-download dialog box that is displayed in the browser.

Returns

The file-stream result object.

File(String, String, String) File(String, String, String) File(String, String, String)

Creates a FilePathResult object by using the file name, the content type, and the file download name.

protected internal virtual System.Web.Mvc.FilePathResult File (string fileName, string contentType, string fileDownloadName);
abstract member File : string * string * string -> System.Web.Mvc.FilePathResult
override this.File : string * string * string -> System.Web.Mvc.FilePathResult
Protected Friend Overridable Function File (fileName As String, contentType As String, fileDownloadName As String) As FilePathResult
Parameters
fileName
String String String

The path of the file to send to the response.

contentType
String String String

The content type (MIME type).

fileDownloadName
String String String

The file name to use in the file-download dialog box that is displayed in the browser.

Returns

The file-stream result object.

Applies to