Last post Jul 05, 2012 07:21 PM by jperl
Jun 24, 2012 08:19 PM|dtretyakov|LINK
If we using multipart form data parser for uploaded form, then it saves form's files on the drive in selected location, for example like this:
var streamProvider = new MultipartFormDataStreamProvider("c:\\tmp\\uploads");
var bodyparts = await Request.Content.ReadAsMultipartAsync(streamProvider);
Who is responsible for removing temp files, which enumerated in the streamProvider.BodyPartFileNames property? If developer, then how removal process can be implemented in the best way?
Jun 24, 2012 10:22 PM|alvingeorge|LINK
I think developer working with system admins need to take care of this.
One suggetion is touse windows scheduler . We can schedule a task to remove files which are "x" number of hours/days old from your temp folder location. Scheduler task can execute an exe or a dos command to do any operations. You can create a small exe
using c# and accept parameter as number of hours and folder location . Schedule that exe with required parameter values with windows scheduler task. See here to understand how a Schedule task can be created http://windows.microsoft.com/en-us/windows7/Schedule-a-task
Jul 05, 2012 07:21 PM|jperl|LINK
I am also curious about this problem. Is there a way to not write to a temporary folder? If not I will look into deleting the files right after.