public void onModuleLoad()
{
VerticalPanel wrapper = new VerticalPanel();
final FileUpload uploader = new FileUpload();
uploader.getElement().setPropertyBoolean("multiple", true);
wrapper.add(uploader);
wrapper.add(vPanel = new VerticalPanel());
uploader.addChangeHandler(new ChangeHandler()
{
@Override
public void onChange(ChangeEvent event)
{
String fileName = uploader.getFilename();
for (String file : fileName.split(","))
{
vPanel.add(new Label(file));
}
}
});
RootPanel.get().add(wrapper);
}
-----------------------------------------------------------------------------------
selected files will be list in file name box(you can see them if using
firefox),but FileUpload.getFileName() will get only first file name,and
further work is how to handle uploading?
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/wV6toVIq388J.
> To post to this group, send email to
> google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
On Wed, 2011-06-15 at 09:13 -0700, Thomas Broyer wrote:
> JSNI and JavaScriptObject "overlay types" FTW!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/lNk39MwjwWgJ.
How to get file list? can you post a code split to show how to do it?
----------------------------------------------------------------------
public static native void getFiles() /*-{
var input =this.@com.domain.client.Clx::fileUpload;
for (var i = 0; i < input.files.length; i++) {
$wnd.alert(input.files[i].name);
}
return
}-*/;
--------------------------------------------------------------------------
Above code will report error:
--------------------------------------------------------------------------
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError):
Cannot read property 'files' of undefined
--------------------------------------------------------------------------