troubleshooting Question uploading picture to a temporary folder

Avatar of ProgrammerAtAIMS
ProgrammerAtAIMS asked on
4 Comments1 Solution139 ViewsLast Modified:
I have a web page where a user can upload a file or picture and if a picture I need to display it in an image field.

I am using an "ajaxToolkit:AsyncFileUpload" and on AsyncFileUpload_UploadedComplete I am saving the Image and showing it using this code :
 Protected Sub AsyncFileUpload_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs)
    If e.State = AjaxControlToolkit.AsyncFileUploadState.Success Then
         If AsyncFileUpload.HasFile Then
             Dim filename As String = System.IO.Path.GetFileName(e.FileName)
             Dim fileextension As String = IO.Path.GetExtension(AsyncFileUpload2.FileName)
             Dim strPath As String = MapPath("~/temp/") + filename
             If IsValidImage(fileextension) Then                
                 Image.imageurl = strPath
                 Image.imageurl = Defaultpth
             End If
                 Session(ViewState("page_id") + "fileuploaded") = 1
         End If
    End If
 End Sub

My code is working fine but after a while this temp folder I created is getting very large and I need to clear it.
I need to know if there is a way to upload my file to a temporary folder that is cleared after a while automatically without having to clear it manually.
Thank you in advance
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros