Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 571
Product
FileUp
Version
4
Title
Temporary files not deleted when using FileUp in .NET
Problem
After FileUp processes an upload to a .uplx page, some temporary files remain and have to be deleted manually.

This issue is usually caused when a form is uploaded to a .uplx page with some unpopulated file input fields. When the upload hits the server, FileUp will create a temporary file for each file input field in the form, whether or not it is populated. After FileUp processes the upload, it will have saved the files specified in the populated file input fileds, and removed these fields' associated temporary files. However, the temporary files associated with the file input fields that were not populated, still remain.

For example, the form has 10 file input fields and the user only chooses 4 files and uploads the form to a .uplx page. On the server, 10 temporary files are created, but after FileUp saves the 4 uploaded files, 6 temporary files, with size 0, remain. And these files remain until they are manually deleted.
Solution
To avoid having to manually delete the remaining temporary files and ensure thorough cleanup of temporary files, when you are finished using an instance of FileUp under .NET, always call FileUp.Dispose(). For example,

//--- create an instance of FileUp
FileUp oFileUp = new FileUp(Context);

//--- set the path
oFileUp.Path = "C:\\temp");

//--- get the file
SaFile oFile = (SaFile)oFileUp.Form["myFile"];

//--- save the file
oFile.Save();

//--- clean up temp files
oFileUp.Dispose();
Created : 5/30/2003 3:41:37 PM (last modified : 5/30/2003 3:41:34 PM)
Rate this article!
Comments