-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4275185
By: jimmyzou
Media media = Fileupload.get();
but the media's API do not provide the method about how to get the uploaded file's size?
Is ther anyone can help me ?
thkx a lots.
Hello psingh,
I answered a similar question that you posted at the following url:
http://forum.zkoss.org/question/101539/how-to-get-size-of-media/?answer=101541#post-id-101541
Best Regards,
Darksu
If I am going to upload 1 gb file and using the below code
byte[] uploadedfile = IOUtils.toByteArray(media.getStreamData());
It is taking too much time on this line even hangout my application.
Is there any other way to get the uploaded file size in limited time?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4275507
By: sousa1981
I am using apache commons io jar to convert:
import org.apache.commons.io.IOUtils;
Media media = Fileupload.get();
byte[] uploadedfile = IOUtils.toByteArray(media.getStreamData());
System.out.println("FILESIZE: " + uploadedfile.length);
System.out.println("FORMAT: " + media.getFormat());
As you can see, the method IOUtils.toByteArray only convert the inputstream to byte array, then, you can write your own method to do that.
Marcos de Sousa
Asked: 2007-04-23 05:55:21 +0800
Seen: 401 times
Last updated: Sep 20 '16