使用IE上传文件后无法删除文件所在的文件夹,但可以删除该文件。通过Firefox上传后没问题。如何解锁目录?
我的代码:
DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory();
ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory);
List<FileItem> uploadedItems = servletFileUpload.parseRequest(request);
if (uploadedItems != null && !uploadedItems.isEmpty()) {
FileItem fileItem = uploadedItems.get(0);
InputStream is = fileItem.getInputStream();
long jobId = importService.importFileAsync(is, fileItem.getName());
is.close();
return jobId;
}
我用importFileAsync
方法:
public long importFileAsync(final InputStream inputStream, final String fileName) {
Job job = new Job() {
@Override
protected void compute() throws ApplicationException {
try (InputStreamReader inputReader = new InputStreamReader(inputStream, "UTF-8")){
//processing of data from file
} catch(Exception e){
//processing of exception
}
}
}
...
}
答案 0 :(得分:0)