File file = new File("E://rawSpeechRecordData//");
File newFile = null;
if (!file.exists()) {
file.mkdir();
if (file.isDirectory()) {
SimpleDateFormat format = new SimpleDateFormat(
"yyyyMMddHHmmss");
String date = format.format(new Date(System
.currentTimeMillis()));
newFile = new File(
"E://rawSpeechRecordData//"+fileNametemp + date
+".pcm");
item.write(newFile);
//数据存入数据库
System.out.println("**********************"
+ newFile.getPath());
mFileInfoDao.addFilePathInfos(newFile.getPath(), fileNametemp);
printWriter.write("数据提交成功!");
System.out.println(file);
System.out
.println("Content-Disposition: form-data; name=\"file\"; filename=\"");
System.out.println("**********************");
}
} else {
if (file.isDirectory()) {
SimpleDateFormat format = new SimpleDateFormat(
"yyyyMMddHHmmss");
String date = format.format(new Date(System
.currentTimeMillis()));
newFile = new File(
"E://rawSpeechRecordData//"+fileNametemp + date
+".pcm");
item.write(newFile);
//数据存入数据库
mFileInfoDao.addFilePathInfos(newFile.getPath(), fileNametemp);
printWriter.write("数据提交成功!");
System.out.println("**********************"
+ newFile.getPath());
System.out.println(file);
System.out
.println("Content-Disposition: form-data; name=\"file\"; filename=\"");
System.out.println("**********************");
}
}
}
}
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.print(e.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}