On Tuesday, June 21, 2011 9:11:28 AM UTC+2, Alex Luya wrote:
>
> How to get file list? can you post a code split to show how to do it?
> ----------------------------------------------------------------------
> public static native void getFiles() /*-{
> var input =th...@com.domain.client.clx::fileUpload;
>

'static' + 'this' ?!
 

>        
>        for (var i = 0; i < input.files.length; i++) {
>           $wnd.alert(input.files[i].name);
>        }
> return 
> }-*/;
>

Yes, that's the idea (we made a JavaScriptObject for the File JS object, and 
a helper method to get a JsErray<JsFile> out of an InputElement)
 

> --------------------------------------------------------------------------
> Above code will report error:
> --------------------------------------------------------------------------
> Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError):
> Cannot read property 'files' of undefined  
> --------------------------------------------------------------------------
>
>
>
Also, is your fileUpload field an InputElement or a FileUplaod widget? if a 
FileUpload widget, you'll have to call 
@.com.google.gwt.user.client.ui.Widget::getElement() on it first.

-- 
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/-/kP9XDkdutBIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to