Drag a file to upload it
FileEdit
Here is an example that demonstrates the use of a FileEdit
component.
FileEdit (Extended Properties)
This demonstrates the most common properties that are availabe to set on the FileEdit
.
Drag a file to upload it
File Upload Pre-Processing
If you have the need to pre-process files before they are saved to Dataverse, there is a way to hook into the upload process to allow for custom handling of the file.
// In your startup class call the following:
services.Configure<FileSaveOptions>(options => {
// Files can be saved to a temporary folder on the server or to an in-memory stream.
options.SaveMode = FileSaveMode.SaveToTemporaryFolder;
// Specify your pre-process handler
options.FileProcessorMethod = async (columnFileInfo) => {
// Perform your processing here
var mutatedFileData = SomeMethodToManipulateTheByteArray(columnFileInfo.FileInfo.Data)
return new FileInfo { FileName="New File Name", Data=mutatedFileData};
};
});
FileSaveOptions Class
Properties
Name | Type | Default | Description |
---|---|---|---|
FileProcessorMethod | Func<ColumnFileInfo, Task<FileInfo>>? | ||
SaveMode | FileSaveMode | SaveToTemporaryFolder |
ColumnFileInfo Class
Properties
Name | Type | Default | Description |
---|---|---|---|
ColumnName | string | ||
FileInfo | FileInfo | ||
TableName | string |
FileInfo Class
Properties
Name | Type | Default | Description |
---|---|---|---|
FileData | byte[]? | ||
FileName | string | ||
FileSizeInBytes | long | 0 |
FileEdit Class
Parameters
Name | Type | Default | Description |
---|---|---|---|
ChildContent | RenderFragment? | Child content of the component | |
ColumnName | string | Column logical name to bind the editor to from the table record. | |
Description | string? | Description to be displayed in the tooltip. | |
Disabled | bool? | Should the editor be disabled. | |
DisplayLabelWhenAvailable | bool | True | Specifies whether to display a lable if available. |
DisplayTooltipWhenAvailable | bool | True | Specifies whether to display a tooltip if available. |
DisplayValidationErrorMessage | bool | True | Should a validation error message be displayed when the component fails validation? |
IsVisible | bool | True | Is the editor visible. |
Label | string? | Text to be displayed as a label for the editor. | |
MaxFileSizeInBytes | long? | Gets or sets the maximum size of a file to be uploaded (in bytes). Default value is 10 MB or the value specified by the column metadata. | |
ReadOnly | bool? | Should the editor be read-only. | |
Required | bool? | Should the value be required. | |
Value | FileValue? | Value of the column. |
Methods
Name | Parameters | Type | Description |
---|---|---|---|
GetValidationErrors | List<string> | Returns a collection of the current validation errors. |