get drop file from q-file? #3041
Replies: 2 comments 1 reply
-
Hi @atticus-lv, I think Quasar's QFile can only pick files, but can't upload them. Just recently I found the following solution for another project. It creates a hidden upload = ui.upload(auto_upload=True, on_upload=lambda e: ui.notify(f'{len(e.content.read())} bytes')).classes('hidden')
ui.button('Upload', on_click=lambda: upload.run_method('pickFiles')) Even though you don't see the list of uploaded files, this approach might be suitable for a more minimal UI for uploading a file. |
Beta Was this translation helpful? Give feedback.
-
I managed to get the selected file with the from nicegui import ui
qfile = ui.element('q-file').props('filled label="Drop File Here"')
qfile.on('update:model-value', lambda e: print(f"File: '{e.args.get('name')}'"))
ui.run() What I don't understand is why the Q-File element is not showing the selected file inside of it. I looked at the documentation and I don't see any special thing I could be missing out. Even adding the |
Beta Was this translation helpful? Give feedback.
-
Question
hi there. I wonder if I can use
ui.element('q-file').props('filled label="Drop File Here"')
just like theui.upload
(both pick/drop files)Sometimes the ui.upload is too big to place in a single line, so I want to use q-file for custom upload(drop file almost. I have already try the file picker example).
However I don't know how to get to callback from this custom element
Beta Was this translation helpful? Give feedback.
All reactions