Spring提供的读取文件的类,使用方便,依赖spring-web-3.1.2.RELEASE.jar
包路径:
java.lang.Object
org.springframework.web.multipart.commons.CommonsMultipartFile
byte[] | getBytes() |
Return the contents of the file as an array of bytes. |
String |
getContentType() |
Return the content type of the file. |
FileItem | getFileItem() |
Return the underlying org.apache.commons.fileupload.FileItem instance |
InputStream | getInputStream() |
Return an InputStream to read the contents of the file from. |
String | getName() |
Return the name of the parameter in the multipart form. |
String | getOriginalFilename() |
Return the original filename in the client‘s filesystem. |
long | getSize() |
Return the size of the file in bytes. |
String | getStorageDescription() |
Return a description for the storage location of the multipart content. |
protected boolean |
isAvailable() |
Determine whether the multipart content is still available. |
boolean | isEmpty() |
Return whether the uploaded file is empty, that is, either no file has been chosen in the multipart form or the chosen file has no content. |
voic | transferTo(File dest) |
Transfer the received file to the given destination file. |
使用方法:
CommonsMultipartFile---用Spring实现文件上传
原文:http://www.cnblogs.com/lin-bear/p/5193096.html