How to get InputStream and size of File type in servlet?
Previously i was using FileUpload type which has getInputStream() and getSize() methods, but now i have to use File type for bulk upload. I have tried but File type has no such methods.
Use
File#length()to get the size.Use
FileInputStreamconstructor to create anInputStreambased on a givenFile.See also the
Filejavadoc and the basic Java I/O tutorial.