使用jspsmartupload组件以时间+文件类型的方式保存文件
2008-03-04 21:07
711 查看
int count=0;
// Initialization
mySmartUpload.initialize(pageContext);
// Upload
mySmartUpload.upload();
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
String strExt = mySmartUpload.getFiles().getFile(0).getFileExt();
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS");//取系统时间,精确到毫秒。
java.util.Date date = new java.util.Date();
String strTime = simpleDateFormat.format(date);
String strFileName = strTime + "." + strExt;
String FilePath = uploadpath+strFileName;//uploadpath为保存目录名。
try
{
//count = mySmartUpload.save(uploadpath);
myFile.saveAs(FilePath);
}
catch (Exception e)
{
out.println(e.toString());
}
// Initialization
mySmartUpload.initialize(pageContext);
// Upload
mySmartUpload.upload();
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
String strExt = mySmartUpload.getFiles().getFile(0).getFileExt();
java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS");//取系统时间,精确到毫秒。
java.util.Date date = new java.util.Date();
String strTime = simpleDateFormat.format(date);
String strFileName = strTime + "." + strExt;
String FilePath = uploadpath+strFileName;//uploadpath为保存目录名。
try
{
//count = mySmartUpload.save(uploadpath);
myFile.saveAs(FilePath);
}
catch (Exception e)
{
out.println(e.toString());
}
相关文章推荐
- 在jsp中使用smartupload组件上传文件
- 使用jspSmartUpload组件进行文件上传、下载
- 【转】在jsp中使用smartupload组件上传文件
- 使用jspSmartUpload组件进行文件上传、下载
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 使用smartupload组件实现jsp+jdbc上传下载文件实例解析
- 项目开发技巧(四):使用JspSmartupload实现文件上传下载(一):JspSmart之upload组件源码及使用
- 使用jspSmartUpload组件进行文件上传、下载
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件- -
- 在jsp中使用smartupload组件上传文件
- 使用smartupload组件实现jsp+jdbc上传下载文件
- 使用jspSmartUpload组件进行文件上传、下载、批量下载
- 使用jspSmartUpload组件进行文件上传、下载
- jsp使用jspSmartUpLoad组件实现中文文件下载
- 使用JspSmartUpload组件上传文件
- Servlet.service() for servlet jsp threw exception java.lang.Il在jsp中使用jspsmartupload组件下载文件时将抛出异常的解决方案
- 使用jspsmartupload组件在servlet里面上传文件
- JSP中使用jspsmartupload组件进行文件的上传和下载