Image Upload
info
This widget is deprecated. Use the Image Upload widget instead.
Allows for image file uploads with preview and validation.
Examples
Basic Example
The following example demonstrate some of the available functionality for read_image
from abstra.forms import read_image
file_response = read_image("Upload your .png image")
file = file_response.file # File object
Parameters
Name | Description | Type |
---|---|---|
label | The label to display to the user | str |
initial_value | The initial value to display to the user. Defaults to "". | str |
multiple | Whether the user will be allowed to upload multiple files. Defaults to False. | bool |
max_file_size | Maximum size allowed to be transfered in total in MB. | float |
disabled | whether the input is disabled. Defaults to False. | bool |
required | Whether the input is required or not eg. "this field is required". Defaults to True. | Union[bool, str] |
hint | A tooltip displayed to the user. Defaults to None. | str |
full_width | Whether the input should use full screen width. Defaults to False. | bool |
button_text | What text to display on the button when the widget is not part of a Page. Defaults to 'Next'. | str |
Return Values
Type | Description |
---|---|
Union[FileResponse, List[FileResponse]] | A dict containing the image file uploaded by the user: FileResponse(path: Path, file: BufferedReader). If the multiple flag is set as True, it might contain a list of FileResponses. |