Java基础知识:Servlet实现文件的上传与下载(3)
日期:2013-10-12 17:11
* 产生临时文件对象
* 会检查临时目录是否存在,如果不存在将创建目录
* @return 临时文件对象
* @throws IOException
*/
private File getTempFile()throws IOException{
File tempFolder = new File(this.tempFileFolder);
if (!tempFolder.exists()){
tempFolder.mkdirs();
}
String tempFileName = this.tempFileFolder+File.separator+Math.abs(RANDOM.nextInt());
File tempFile = new File(tempFileName);
if (!tempFile.exists()){
tempFile.createNewFile
1/3 下一页 上一页 首页 尾页
返回
刷新
WAP首页
网页版
登录
05/20 02:20