I have used the ajax file uploader with the progress bar on .net webforms v4. Everything works fine until the uploaded file is deleted by a user. I have an html button triggers the deletion through a json function. When the delete button is clicked, the uploaded file and its folder are deleted sucessfully. When a second file is uploaded, the progress bar runs but no file is uploaded or saved... If the delete button is NOT clicked, then the uploader uploads the second file successfully...
I would appreciate any help.
The delete function is as follows:
$.ajax({
type: "POST",
url: "../FileUpload.asmx/DeleteUploadedFile",
data: "{dirPath: 'xxxxxx'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert('success');
}
});
The File Upload cs is as below:
[WebMethod]
public void DeleteUploadedFile(string dirPath)
{
Directory.Delete(HttpContext.Current.Server.MapPath(dirPath), true);
}