-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I am successfully doing file uploads:
<button label="..." upload="true,maxsize=10240,multiple=false"
onUpload="@command('uploaded', uplEvent = event)" />
I want to know if I can get the name of the file the user chose. Currently I can read the raw contents (bytes) at my viewmodel:
@Command
public void uploaded(@BindingParam("uplEvent") UploadEvent evt) {
...
I would like to have a String with something like my_image.png
or whatever the selection was made by the user.
you can get the file name via:
UploadEvent#getMedia()) -> Media#getName())
in your case: evt.getMedia().getName()
should give the desired result
In MVVM I tend not to add the raw event object into my ViewModel and do this instead:
<button label="..." upload="true,maxsize=10240,multiple=false"
onUpload="@command('handleUpload', media = event.media)" />
@Command
public void handleUpload(@BindingParam("media") Media media) {
System.out.println(media.getName());
}
Asked: 2018-05-11 01:14:54 +0800
Seen: 7 times
Last updated: May 14 '18
How to control selectAll() feature in a Listbox with multiple=true and checkmark=true
ZK8 Wizard Series: Part 2 now released!
Faster And Lighter, The Performance Test On ZK8
org.zkoss.xel.XelException: Resource not found: http://www.zkoss.org/dsp/web/core
How To Check Dirty Status in ZK8?
Come and join the ''JS'' Hunt!
great, it works. I was doing
jgomer2001 ( 2018-05-14 22:29:54 +0800 )editevent.getName()
:(