IFormFile Interface

Represents a file sent with the HttpRequest.

Namespace
Microsoft.AspNetCore.Http
Assemblies
  • Microsoft.AspNetCore.Http.Features

Syntax

public interface IFormFile
interface Microsoft.AspNetCore.Http.IFormFile

Properties

Microsoft.AspNetCore.Http.IFormFile.ContentDisposition

Gets the raw Content-Disposition header of the uploaded file.

Return type:System.String
string ContentDisposition { get; }
Microsoft.AspNetCore.Http.IFormFile.ContentType

Gets the raw Content-Type header of the uploaded file.

Return type:System.String
string ContentType { get; }
Microsoft.AspNetCore.Http.IFormFile.FileName

Gets the file name from the Content-Disposition header.

Return type:System.String
string FileName { get; }
Microsoft.AspNetCore.Http.IFormFile.Headers

Gets the header dictionary of the uploaded file.

Return type:Microsoft.AspNetCore.Http.IHeaderDictionary
IHeaderDictionary Headers { get; }
Microsoft.AspNetCore.Http.IFormFile.Length

Gets the file length in bytes.

Return type:System.Int64
long Length { get; }
Microsoft.AspNetCore.Http.IFormFile.Name

Gets the name from the Content-Disposition header.

Return type:System.String
string Name { get; }

Methods

CopyTo(System.IO.Stream)

Copies the contents of the uploaded file to the <em>target</em> stream.

Arguments:target (System.IO.Stream) – The stream to copy the file contents to.
void CopyTo(Stream target)
CopyToAsync(System.IO.Stream, System.Threading.CancellationToken)

Asynchronously copies the contents of the uploaded file to the <em>target</em> stream.

Arguments:target (System.IO.Stream) – The stream to copy the file contents to.
Return type:System.Threading.Tasks.Task
Task CopyToAsync(Stream target, CancellationToken cancellationToken = null)
OpenReadStream()

Opens the request stream for reading the uploaded file.

Return type:System.IO.Stream
Stream OpenReadStream()