Vaadin Upload

Hi

I added a vaadin “Upload” component to upload files to the server and this works perfectly. But the problem is I can upload any types of files. So I need to do some validations before uploading the file to the server (i.e. only PNG can be uploaded).

If I select a file, how could I retrieve the location in the local machine of that currently selected file, which is do be uploaded to the server?

Regards
Alchemist

Hi,

For both of your requests you will need a Java applet, flash helper (E.g. swfupload, which is also used by EasyUploads) or something similar for a cross browser solution. This is the same issue with each and every web app library. Only modern browsers like FF4, Safari and Chrome will let you inspect the file before it is submitted to the server. And on the other hand, only IE reveals the full path of the file on the client side to the server.

IMO this is not a big problem with Vaadin. Most often you will want to use upload in “immediate mode” (http://demo.vaadin.com/sampler/#ImmediateUpload). There you can call interrupt() once the uploading starts if you wish to ignore the file and show error message at that point.

cheers,
matti

Hi

Thank you for your prompt answer. What I did was I performed the validations on the image resolution only after the server received the image. Seems this is the only way. Is there are any other ways to do so? Also I tried with immediate mode and EasyUpload components. EasyUpload addon was pretty cool.

Thanks and Regards
Alchemist