Method FromFile
FromFile(string, string?, string?)
Creates a source that reads a file. Each read opens the file and checks that its length and last write time are still the ones it had when the source was created, so that a file that changes fails the read with an IOException instead of being uploaded with other content. Other processes can read, write and delete the file while a read has it open.
Declaration
public static UploadSource FromFile(string path, string? fileName = null, string? contentType = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The path of the file. |
| string | fileName | The file name that the service receives. Default is null, which uses the name in
|
| string | contentType | The content type of the file, such as |
Returns
| Type | Description |
|---|---|
| UploadSource |
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | The file does not exist. |