Store uploaded files data in Upload class objects? #154
Replies: 4 comments
-
ui.upload has an upload complete event:
Is that what you are looking for? It is done this way because multiple files can be uploaded with one |
Beta Was this translation helpful? Give feedback.
-
Yes, I know about that handler. I just thought it could be nice to store uploaded files data in |
Beta Was this translation helpful? Give feedback.
-
I'd argue that the result of an event should not automatically be part of the UI element's state. You also wouldn't expect a button to have x/y properties containing the mouse coordinates of the last click event. These event arguments are rather volatile and usually only of value for those consumers that subscribe to the event in the first place. The value of input elements is a bit different - in my opinion: The value is often part of the visible state, e.g. the content of an input field, the position of a slider or the state of a checkbox. Furthermore, it's (initial) value often can be set programmatically, making a r/w property very handy. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your input. That's why I made it a discussion rather than issue. |
Beta Was this translation helpful? Give feedback.
-
Ordinary components' values can be accessed as
value
attribute, whereas no similar attribute exists in Upload class.Maybe store the uploaded files in
files
attribute?I'm not sure about this, because on another hand it could cause memory consumption increase because reference to file contents will be around for longer than just in
on_upload
handler.Consider this as an idea rather than an issue.
Beta Was this translation helpful? Give feedback.
All reactions