You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2006/08/27 16:01:38 UTC

size of UploadedFile

Is there a way to get file size of an UploadedFile without calling getBytes() or writing to a new file using getInputStream()?  A file can be large, like 10M.
   
  An UploadedFile is either on disk or memory, and thus its size is available. But the class does not have a method
     long  uploadedFile.size();
   
  Thanks!

 		
---------------------------------
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

Re: size of UploadedFile

Posted by Dave Brondsema <da...@brondsema.net>.
Dave wrote:
> Is there a way to get file size of an UploadedFile without calling
> getBytes() or writing to a new file using getInputStream()?  A file can
> be large, like 10M.
>  
> An UploadedFile is either on disk or memory, and thus its size is
> available. But the class does not have a method
>    long  uploadedFile.size();
>  

Yes it does:

public interface UploadedFile extends Serializable
{

...


    /**
     * Answer the size of this file.
     * @return long
     */
    long getSize();
}


-- 
Dave Brondsema
Software Developer
Cornerstone University