Multiple single-file uploads with 1 upload button?

Hi,
I’m new to vaadin, so please bare with me.

I already looked into easyuploads addon and the standard vaadin Upload component but none of these seems to offer the possibility to provide several (single-file) filechoosers with one (1) upload button (at the end) which triggers the uploads of files of all filechoosers on that page.

Like that:

[filechooser]

[filechooser]

[filechooser]

[filechooser]

[filechooser]

[filechooser]

[uploadbutton]

I don’t want to use a multiple-file chooser like in easyuploads since it doesn’t work for me in IE8+9 for some reason.

Any hints on this would be greatly appreciated.

Thank you,
Kersten

Hi,

Why do you want to waste your users time by not starting the upload immediately (setImmediate(true))? If he must upload e.g. 10 * 1mb files, he’ll have to wait for 10mb to upload once he gets to push the upload button that triggers them all. If you start uploads automatically as files are selected, there is probably just on or two left when he has selected the last one.

MultiFileUpload in EasyUploads worked like this earlier, until I implemented “multiple” for real browsers and the flash fallback for IE. If I remember correctly it still remains “available” for more once one or more files have been selected.

In 6.6 there is (will be once released) a server side api to trigger upload : http://dev.vaadin.com/ticket/6630 . But as stated earlier I’d really suggest another kind of patter for modern web apps.

What exactly was the issue with EasyUploads MultiFileUpload? It uses flash fallback in IE, but I have assumed that everybody (except mobile users) have flash installed these days.

cheers,
matti

Hi

I am also looking for similar solution .

I need to upload multiple files from different sites

Say , site A ,has 3 files to upload
site B, has 4 files to upload .

i need to upload all or say tell location from where to upload files at once ,and finally press upload_Final button to start the upload .
After uploading i am parsing the stream that i get after upload and parsing them and then saving the parsed data to DB .
So i have to show progress monitor ,
Set immidiate wont help me .

Aslo i tried simply adding 10 upload buttons ,but while i am uploading one tar file,and then while frst is uploading ,m uploading second tar file ,then i see actually second tar file is not uploaded ,i ges some thread issue ,like only when one tar file upload done then only we need to start upload another tar file. but user has to wait for so long ,

Considering the above issue ,please let me know a solution ,as i will be uploading more than 10 GB of data at once ,
I have attached the screen shoot.

Below is the code i wrote for Receiver
public class TarFileReveiver implements Receiver {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String fileName;
	private String mtype;
	private String message;

	/**
	 * return an OutputStream that simply counts line ends
	 */
	public OutputStream receiveUpload(String filename, String MIMEType) {

		fileName = filename;
		mtype = MIMEType;
		// final FileOutputStream fos;
		try {
			return new OutputStream() {

				long counter = 0;

				// private TarArchiveEntry tarEntry;

				final File file = new File(dirPath + "//"
						+ fileName);
				final FileOutputStream fos = new FileOutputStream(file);
				final BufferedOutputStream bos = new BufferedOutputStream(
						fos);

				@Override
				public void write(int b) throws IOException {

					// insTime and site information from UI,ALSO IF POSSIBLE
					// FILE NAME
					counter++;

					bos.write(b);

					message = "Upload in progress..";
					if (counter == contentLength) {
						// System.out.println("data parsing started ...");
						insTime = new Date(System.currentTimeMillis());
						// System.out.println("getSelectedSite() "
						// + getSelectedSite());
						bos.flush();
						bos.close();
						message = " Upload done..";
						result.setValue(tarFileReveiver.getMessage()
								+ " (Importing...)");
						state.setValue("Importing");

						try {
							// long y = System.currentTimeMillis();
							InputStream is = new FileInputStream(file);
							BufferedInputStream bis = new BufferedInputStream(
									is);
                                                                                                                            //here i am sending the file for parsing 
							new LogParserService().parse(getSelectedSite(),
									insTime, insfileNm, mtype, bis);

							is.close();																                                                                                                 message = " Import done..";
						} catch (Exception e) {
							getWindow().showNotification(e.getMessage(),
									Notification.TYPE_ERROR_MESSAGE);
						}

					}
				}
			};
		} catch (Exception ignore) {
			ignore.printStackTrace();
			return null;
		}
	}

	public String getFileName() {
		return fileName;
	}

	public String getMimeType() {
		return mtype;
	}

	public String getMessage() {

		return message;
	}

}

Please help me on this ,
Also i am not able to use the add on provided ,as the APi usage is not that clear to me .
11728.png

Hello Neha,

i want to ask you if you have solved ur problem?
because right now I am having the same issue like you.

I want to make a vaadin application that can enable user to select files, and i want to list this files first.
After that, i want to have an extra button, This button is to upload the files selected by the user.

How do you prevent the Upload button from dissapearing when the end user choses a file with a long file name?