Controller.File 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
File(Byte[], String) |
使用文件内容和文件类型创建一个 FileContentResult 对象。 |
File(Stream, String) |
使用 Stream 对象和内容类型创建一个 FileStreamResult 对象。 |
File(String, String) |
使用文件名和内容类型创建一个 FilePathResult 对象。 |
File(Byte[], String, String) |
使用文件内容、内容类型和目标文件名创建一个 FileContentResult 对象。 |
File(Stream, String, String) |
使用 Stream 对象、内容类型和目标文件名创建一个 FileStreamResult 对象。 |
File(String, String, String) |
使用文件名、内容类型和文件下载名创建一个 FilePathResult 对象。 |
File(Byte[], String)
使用文件内容和文件类型创建一个 FileContentResult 对象。
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
参数
- fileContents
- Byte[]
要发送到响应的二进制内容。
- contentType
- String
内容类型(MIME 类型)。
返回
文件内容结果对象。
适用于
File(Stream, String)
使用 Stream 对象和内容类型创建一个 FileStreamResult 对象。
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
参数
- fileStream
- Stream
要发送到响应的流。
- contentType
- String
内容类型(MIME 类型)。
返回
文件内容结果对象。
适用于
File(String, String)
使用文件名和内容类型创建一个 FilePathResult 对象。
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
参数
- fileName
- String
要发送到响应的文件的路径。
- contentType
- String
内容类型(MIME 类型)。
返回
文件流结果对象。
适用于
File(Byte[], String, String)
使用文件内容、内容类型和目标文件名创建一个 FileContentResult 对象。
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
参数
- fileContents
- Byte[]
要发送到响应的二进制内容。
- contentType
- String
内容类型(MIME 类型)。
- fileDownloadName
- String
浏览器中显示的文件下载对话框内要使用的文件名。
返回
文件内容结果对象。
适用于
File(Stream, String, String)
使用 Stream 对象、内容类型和目标文件名创建一个 FileStreamResult 对象。
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
参数
- fileStream
- Stream
要发送到响应的流。
- contentType
- String
内容类型(MIME 类型)
- fileDownloadName
- String
浏览器中显示的文件下载对话框内要使用的文件名。
返回
文件流结果对象。
适用于
File(String, String, String)
使用文件名、内容类型和文件下载名创建一个 FilePathResult 对象。
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
参数
- fileName
- String
要发送到响应的文件的路径。
- contentType
- String
内容类型(MIME 类型)。
- fileDownloadName
- String
浏览器中显示的文件下载对话框内要使用的文件名。
返回
文件流结果对象。