如何在上传文件的时候,同时把这个文件自动命名
2005-03-27 21:50
525 查看
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (!myFile.isMissing()) {
filename=myFile.getFileName();
String suffix=filename.substring(filename.lastIndexOf('.'));
Date now=new Date();
filename=String.valueOf(now.getTime())+suffix;
url="/download/userdoc/"+filename;
// Save the files with its original names in a virtual path of the web server
myFile.saveAs(url);
if (!myFile.isMissing()) {
filename=myFile.getFileName();
String suffix=filename.substring(filename.lastIndexOf('.'));
Date now=new Date();
filename=String.valueOf(now.getTime())+suffix;
url="/download/userdoc/"+filename;
// Save the files with its original names in a virtual path of the web server
myFile.saveAs(url);
相关文章推荐
- 如何让wordpress上传图片的时候自动命名?
- 停顿几秒后自动跳转,这个时候如何在页面上显示倒计时
- SpringMVC使用js提交表单上传多文件,并如何防止表单自动提交
- 当我们修改WEB-INF下的任何一个配置文件的时候,如何让tomcat自动加载
- thinkphp同时上传多个文件并统一命名
- 上传文件时使用IP或时间戳自动命名文件操作工具类
- 多个表单中如何获得这个文件上传的网址实现js代码
- 写一个脚本,对一个文件夹内指定格式的文件做重命名处理,要求:重命名为数字编号从1开始,当有新增文件的时候,自动重名并跟随末尾编号格式,中间删减的时候,末尾名称自动改名补回空缺序号
- 当上传文件的时候自动过滤掉其他格式的文件(ie8 ie9问题待解决)
- wordpress上传文件自动重命名的方法-原创-避免中文乱码
- 如何在新建或复制的时候,以日期命名文件!
- Android程序的时候就要设计到编写xml布局文件,这里就教你如何设置xml的自动补全。
- struts如何实现上传文件的重命名????
- 如何在新建或复制的时候,以日期命名文件!
- 如何实现文件上传并自动归类功能?
- 如何在pc端批量自动上传文件到百度云盘(其他云盘)
- servlet如何处理html form表单上传文件的同时传入的参数
- 如何写一个bat批处理自动上传文件到FTP
- django如何给上传的图片重命名(给上传文件重命名)
- 如何设置input实现同时选中多个文件并同时上传