-
FEATURED COMPONENTS
First time here? Check out the FAQ!
<button label="Upload" onClick="Fileupload.get(-1);" onUpload="processMedia(event.getMedias());"/>
<zscript deferred="true"><![CDATA[
import org.zkoss.util.media.Media;
public void processMedia(Media[] media) {
if (media != null)
{
for (int i = 0; i < media.length; i++)
{
System.out.println("Media is not null::>"+media.getName());
}
}
else
System.out.println("Media is null");
}
]]></zscript>
above is my code it is getting executed successfully bt it doesnot print anything on d console as i have printed the msgs , i want to save the selected file to d diskwat could b the problem?
File chooser is appearing..please help me
hello does anybody knw???
Check out this thread: http://www.zkoss.org/forum/listComment/17228-Fileupload-get-1-is-returning-null
I tried that code but now it is giving error on media.getStreamData as
java.lang.NullPointerException "Attempt to invoke method getStreamData on null value"
why is it like this media is not null as it goes inside the if but media [ i ] is nulll
hi samchuang,
I have used both the approaches but somehow the media is gettting the elements as media is not null but as soon as I try to access it i. e. media[0].getName it gets exception that "Attempt to invoke method getStreamData on null value" and I cant figure out what the problem is. And the document you shared I have read it but it does not help with my problem.
????
Asked: 2011-09-06 01:26:06 +0800
Seen: 242 times
Last updated: Sep 08 '11