首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

IE和Chrome的在文件下传中的区别

2012-12-20 
IE和Chrome的在文件上传中的区别Why does FileItem.getName() return the whole path, and not just the f

IE和Chrome的在文件上传中的区别

Why does FileItem.getName() return the whole path, and not just the file name?
Internet Explorer provides the entire path to the uploaded file and not just the base file name. Since FileUpload provides exactly what was supplied by the client (browser), you may want to remove this path information in your application. You can do that using the following method from Commons IO (which you already have, since it is used by FileUpload).
    String fileName = item.getName();    if (fileName != null) {        filename = FilenameUtils.getName(filename);    }

热点排行