File size: 748 Bytes
2b4d75c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Form / File Upload
# Use a file #upload component to allow users to upload files.
# #form #file_upload
# ---
from h2o_wave import main, app, Q, ui


@app('/demo')
async def serve(q: Q):
    if 'file_upload' in q.args:
        q.page['example'] = ui.form_card(box='1 1 4 10', items=[
            ui.text(f'file_upload={q.args.file_upload}'),
            ui.button(name='show_upload', label='Back', primary=True),
        ])
    else:
        q.page['example'] = ui.form_card(
            box='1 1 4 7',
            items=[
                ui.file_upload(name='file_upload', label='Upload!', multiple=True,
                               file_extensions=['csv', 'gz'], max_file_size=10, max_size=15)
            ]
        )
    await q.page.save()