Last post Jan 22, 2014 07:00 PM by ianlee74
Jun 24, 2012 07: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 09: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 06: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.
Jan 22, 2014 07:00 PM|ianlee74|LINK
Any other thoughts on this? I'm working on the same problem and it seems like a lot of unnecessary overhead to be forced to create a temp file when all I need is the data.