Reputation: 212
I use gwtupload (http://code.google.com/p/gwtupload/) and I need add on start files to this. Someone know how can I do it ?
Upvotes: 0
Views: 215
Reputation: 212
I think that we need add files in servlet
Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>();
/**
* Maintain a list with received files and their content types.
*/
Hashtable<String, File> receivedFiles = new Hashtable<String, File>();
But I dont know how...
Upvotes: 0
Reputation: 9741
I can deduce that you want to add previously uploaded files to the multiuploader list.
There is no way with the current MultiUploader
although you can open a ticket at the project site, and I will implement it on a next release.
But you can extend the MultiUploader
and code a workaround, this example works:
public class GwtTestApp implements EntryPoint {
public void onModuleLoad() {
MyMultiUploader uploader = new MyMultiUploader("file1.txt", "file2.doc");
RootPanel.get().add(uploader);
}
public static class MyMultiUploader extends MultiUploader {
private VerticalPanel panel;
private Widget multiuploader;
@Override
protected void initWidget(Widget widget) {
panel = new VerticalPanel();
super.initWidget(panel);
multiuploader = widget;
}
public MyMultiUploader(String ...files) {
for (String f : files ) {
Uploader u = (Uploader)getUploaderInstance();
IFileInput i = u.getFileInput();
IUploadStatus s = u.getStatusWidget();
i.setVisible(false);
s.setVisible(true);
u.getForm().removeFromParent();
u.setServletPath("whatever");
s.setFileName(f);
s.setStatus(Status.SUCCESS);
final String name = f;
s.addCancelHandler(new UploadCancelHandler() {
public void onCancel() {
Window.alert("Cancel " + name);
}
});
panel.add(u);
}
panel.add(multiuploader);
}
}
}
Upvotes: 1