Vicky Thakor
Vicky Thakor

Reputation: 3916

Multiple gwtupload component on same page

I'm using gwtupload lib for uploading file(s) in my GWT project. https://code.google.com/p/gwtupload/wiki/GwtUpload_GettingStarted

Case: I've 3 - 4 MultiUploader on same page. Its uploading fine. But when I try to upload same file in other component its not allowing. I figured out that if we click on remove button maintained by gwtupload. Its allow to upload same file on other component. So how to fire remove button click. Check image attached below. enter image description here

Upvotes: 0

Views: 267

Answers (2)

This behavior is in this way by design, gwtupload prevents uploading the same file-name if it was successful previously in any instance of uploaders.

You can disable the default feature just calling the avoidRepeatFiles method though.

    MultiUploader uploader1 = new MultiUploader();
    uploader1.avoidRepeatFiles(false);

Upvotes: 1

Vicky Thakor
Vicky Thakor

Reputation: 3916

After digging down source code of gwtupload. I found the solution. If you want to have multiple SingleUploader or MultiUploader on same page. You need to change below lines and need to create .jar file of gwtupload.

private static HashSet<String> fileDone = new HashSet<String>();
private static HashSet<String> fileUploading = new HashSet<String>();
private static List<String> fileQueue = new ArrayList<String>(); 

to (Remove static)

private HashSet<String> fileDone = new HashSet<String>();
private HashSet<String> fileUploading = new HashSet<String>();
private List<String> fileQueue = new ArrayList<String>();

in File Uploader.java located in package gwtupload.client

Upvotes: 0

Related Questions