File Upload¶
Use a file upload component to get one or more files from the user.
Basic¶
Set mode='file' to show a file upload box.
For file uploads to work correctly, you must define a file upload handler in your Django, Flask, Starlette, or Tornado application.
The file upload box sends a multipart/form-data HTTP POST request to the upload location (/upload by default). The uploaded files are each named file. The handler is expected to process the files and return a JSON response containing a string array named files. This array is returned as-is by view() to your Nitro application code.

Allow multiple files¶
Add multi to mode to allow uploading multiple files.
filenames = view(box('Upload some documents', mode='multi file'))
view(f'You uploaded {filenames}.')

Set upload location¶
Set link= to set the location to upload files to.
This is necessary if your app's file upload handler location is different from /upload (the default),
filename = view(box('Upload a document', mode='file', link='/upload'))
view(f'You uploaded {filename}.')

Disable¶
Set disabled=True to disable.
