Drag a file to upload it
FileEdit
The FileEdit component provides file upload and download capabilities for Dataverse file columns. It supports drag-and-drop and displays the current file name when a file is attached.
<FileEdit ColumnName="ppp_contract" />
Max File Size
Use MaxFileSize to set the maximum allowed file size in bytes. Files exceeding this limit are rejected before upload.
<FileEdit ColumnName="ppp_contract" MaxFileSize="5242880" />
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 need to pre-process files before they are saved to Dataverse, use the OnFileUploaded callback to hook into the upload process and apply custom handling to 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.OnFileUploaded = async (columnFileInfo) => {
// Perform your processing here
var mutatedFileData = SomeMethodToManipulateTheByteArray(columnFileInfo.FileInfo.FileData);
return new FileInfo { FileName = "New File Name", FileData = mutatedFileData };
};
});
FileSaveOptions Class
Properties
Name | Type | Default | Description |
|---|---|---|---|
OnFileUploaded | Func<ColumnFileInfo, Task<FileInfo>>? | An optional callback invoked after a file is uploaded and before it is saved to Dataverse. Receives a containing the file data and the target table/column, and returns a with the (potentially modified) file to save. Use this to resize images, convert file formats, scan for viruses, or apply other transformations. | |
SaveMode | FileSaveMode | SaveToTemporaryFolder | The mode used for temporarily storing the file during upload. writes the file to a temporary folder on the server before saving to Dataverse. streams the file directly to Dataverse without intermediate storage. Defaults to . |
Name:
OnFileUploadedType:
Func<ColumnFileInfo, Task<FileInfo>>?
Description:
An optional callback invoked after a file is uploaded and before it is saved to Dataverse.
Receives a containing the file data and the target table/column,
and returns a with the (potentially modified) file to save.
Use this to resize images, convert file formats, scan for viruses, or apply other transformations.
Receives a containing the file data and the target table/column,
and returns a with the (potentially modified) file to save.
Use this to resize images, convert file formats, scan for viruses, or apply other transformations.
Name:
SaveModeType:
FileSaveMode
Default:
SaveToTemporaryFolder
Description:
The mode used for temporarily storing the file during upload.
writes the file to a temporary folder on the server
before saving to Dataverse. streams the file directly to Dataverse
without intermediate storage. Defaults to .
writes the file to a temporary folder on the server
before saving to Dataverse. streams the file directly to Dataverse
without intermediate storage. Defaults to .
ColumnFileInfo Class
Properties
Name | Type | Default | Description |
|---|---|---|---|
ColumnName | string | The logical name of the file or image column the file is being uploaded to. | |
FileInfo | FileInfo | The uploaded file information including file name, size, and binary content. | |
TableName | string | The logical name of the Dataverse table the file is being uploaded to. |
Name:
ColumnNameType:
string
Description:
The logical name of the file or image column the file is being uploaded to.
Name:
FileInfoType:
FileInfo
Description:
The uploaded file information including file name, size, and binary content.
Name:
TableNameType:
string
Description:
The logical name of the Dataverse table the file is being uploaded to.
FileInfo Class
Properties
Name | Type | Default | Description |
|---|---|---|---|
FileData | byte[]? | The raw binary content of the file. May be null if the file has not yet been read into memory. | |
FileName | string | The original file name including the extension (e.g. 'document.pdf'). | |
FileSizeInBytes | long | 0 | The size of the file in bytes. |
Name:
FileDataType:
byte[]?
Description:
The raw binary content of the file. May be null if the file has not yet been read into memory.
Name:
FileNameType:
string
Description:
The original file name including the extension (e.g. 'document.pdf').
Name:
FileSizeInBytesType:
long
Default:
0
Description:
The size of the file in bytes.
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. |
Name:
ChildContentType:
RenderFragment?
Description:
Child content of the component
Name:
ColumnNameType:
string
Description:
Column logical name to bind the editor to from the table record.
Name:
DescriptionType:
string?
Description:
Description to be displayed in the tooltip.
Name:
DisabledType:
bool?
Description:
Should the editor be disabled.
Name:
DisplayLabelWhenAvailableType:
bool
Default:
True
Description:
Specifies whether to display a lable if available.
Name:
DisplayTooltipWhenAvailableType:
bool
Default:
True
Description:
Specifies whether to display a tooltip if available.
Name:
DisplayValidationErrorMessageType:
bool
Default:
True
Description:
Should a validation error message be displayed when the component fails validation?
Name:
IsVisibleType:
bool
Default:
True
Description:
Is the editor visible.
Name:
LabelType:
string?
Description:
Text to be displayed as a label for the editor.
Name:
MaxFileSizeInBytesType:
long?
Description:
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.
Default value is 10 MB or the value specified by the column metadata.
Name:
ReadOnlyType:
bool?
Description:
Should the editor be read-only.
Name:
RequiredType:
bool?
Description:
Should the value be required.
Name:
ValueType:
FileValue?
Description:
Value of the column.
Events
Name | Type | Description |
|---|---|---|
ValueChanged | EventCallback<ColumnValueBase> | Gets or sets a callback that updates the bound value. |
Name:
ValueChangedType:
EventCallback<ColumnValueBase>
Description:
Gets or sets a callback that updates the bound value.
Methods
Name | Parameters | Type | Description |
|---|---|---|---|
GetValidationErrors | List<string> | Returns a collection of the current validation errors. |
Name:
GetValidationErrorsType:
List<string>
Description:
Returns a collection of the current validation errors.
