I am uploading a file from flash to server using apache commons file upload API.
It works fine.Suppose if i cancel the upload,the .tmp file which is created in temp directory is not deleted.
So i added the following line in web.xml which i googled from apache site.
for your ref:
http://commons.apache.org/fileupload/using.html <listener>
<listener-class>
org.apache.commons.fileupload.servlet.FileCleanerCleanup
</listener-class>
</listener>
public static DiskFileItemFactory newDiskFileItemFactory(ServletContext context,
File repository) {
FileCleaningTracker fileCleaningTracker
= FileCleanerCleanup.getFileCleaningTracker(context);
return new DiskFileItemFactory(fileCleaningTracker,
DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD,
repository);
}
1.I just added the web.xml part only.It does not work again.
2. if i call the above method ,my code does not compile which narrates that the constructor DiskFileItemFactory(fileCleaningtracker,int,respository) not found
Is there any other way to delete the .tmp file