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:AsyncFileUplo
ad" and on AsyncFileUpload_UploadedCo
mplete 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
Session(ViewState("page_id") + "fileuploaded") = 1
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 asp.net folder that is cleared after a while automatically without having to clear it manually.
Thank you in advance