Upload component, access to choosen file...

Hi,

I want to have access to name of file (which is choosen by user in upload component, screen attached).

Exist any possibility to reach it (file name) from java code ?
15706.jpg

Hi,

Thats available when you submit the upload. Practically immediately, if you use “upload.setImmediate(true);”, which I suggest to use always.

cheers,
matti

Ok, thank you for your answer.

How I may read the name of this file (chosen file) from upload component, in java code ?

Exist any possibility to read this name before “submit the upload” (after choosing) ?

Hi,

The filename is passed to “Receiver” and also to pretty much all listeners of the Upload component.

Reading the filename beforehand, AFAIK no. But as said, I’d always use the immediate, makes no sense to put user wait on the submit when the (possibly time consuming) upload can be done during filling some other inputs of the form.

cheers,
matti

Ok, thank you.

One question yet:

Do you have any ideas how I may to connect from java script to vaadin upload component:

(from firebug):

after refreshing site value of name has different value…

(I want to use something like that:
String js = " (…) var aName = $(“UPLOADCOMPONENT”).val(); (…)" and run it in this way:
Page.getCurrent().getJavaScript().execute(js);
)

thanks
Areq

resolved :slight_smile:
new version of vaadin has: vaadin.com/api/com/vaadin/ui/Upload.ChangeEvent.html