0

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);
}
B10
  • 173
  • 1
  • 11
  • Do you have any js errors? Aren't you deleting the whole folder and the uploader cannot find the upload path? – Cornea Ali Feb 10 '14 at 13:15
  • No, I don't get any js error. ClientUploadComplete function context.get_postedUrl() is empty, but the preloader runs to 100%. – B10 Feb 10 '14 at 13:42

0 Answers0