wbstr / vaadin-multifileupload

12 stars 23 forks source link

FIles which are uploaded to Temp directory are not getting deleted #11

Closed yannalam closed 8 years ago

yannalam commented 10 years ago

Hi The files which are uploaded to the Temp Directory location are not getting deleted. It would be great if there is a Handler which returns the File object.

Thanks

juger89 commented 10 years ago

I have tested it and I haven't found a case that files had not been deleted. It will be deleted on streamingFinished event when the file has successfully uploaded and the UploadFinishedHandler.handleFile function returned or on streamingFailed event when the user cancels the upload or upload was interrupted for some reason. There is a DefaultUploadReceiver which handles the streaming of files being uploaded but you can optionally replace it with another custom UploadReceiver implementation at the UploadStatePanel constructor.

yannalam commented 10 years ago

Hi Gergely

I am sorry for late reply, let me test once again to find out whether files are getting deleted and thank you for suggestion for writing custom UploadReceiver, I will try this.

To be honest, it works great. Thank You for providing the addon

Thanks Malla Reddy

On Thu, Mar 27, 2014 at 8:48 PM, Gergely Juhász notifications@github.comwrote:

I have tested it and I haven't found a case that files had not been deleted. It will be deleted on streamingFinished event when the file has successfully uploaded and the UploadFinishedHandler.handleFile function returned or on streamingFailed event when the user cancels the upload or upload was interrupted for some reason. There is a DefaultUploadReceiver which handles the streaming of files being uploaded but you can optionally replace it with another custom UploadReceiver implementation at the UploadStatePanel constructor.

— Reply to this email directly or view it on GitHubhttps://github.com/wbstr/vaadin-multifileupload/issues/11#issuecomment-38817083 .

andi0815 commented 9 years ago

Hi,

I was experiencing the same problem in our application. I found out that in our case the problem was our UploadHandler implementation did not close the InputStream given in: public void handleFile(InputStream, String, String, long)

You could consider some ways to mitigate that risk in the future:

  1. In the example/documentation: point out that the stream is expected to be closed by the handleFile()-implementation
  2. In DefaultUploadReceiver.deleteTempFile():
    • Remember the stream in a field and close the stream before trying to delete the file
    • Log a warning, if file could not be deleted

Thanks for the contribution! Andi Maybe you should point out

juger89 commented 8 years ago

Fixed in 1.9.