简体   繁体   中英

ASP.NET server not sending httpresponse to ajax post call after file save

Im making a jquery ajax post call, and the .success method is being called, but the response data is empty.

Javascript:

$.ajax({
        type: 'post',
        url: '/MediaUploader/fileUpload',
        data: formData,
        contentType: false,
        processData: false,
    })
        .done(function (data) {
            //Data 
        })

The success function is called, but the data is empty.

Controller:

[HttpPost]
public ActionResult FileUpload() {
    //code
    file.SaveAs(pathToSave);
    return Json(str_image);

When called, the response is empty: 没有反应

However, commenting out the file.SaveAs, or returning before it, causes the respond to go through:

[HttpPost]
public ActionResult FileUpload() {
    //code
    //file.SaveAs(pathToSave);
    return Json(str_image);

是的回应

When debugging, the file.SaveAs doesn't throw any exceptions, and in both cases the return is reached. Also, this problem only is occurring on the remote. On local host both versions work fine.

The response doesnt go through only after the file.SaveAs on remote server.

Fixed, it was a problem with directory permissions.

(weird, i didnt think it's an issue because the files were being uploaded successfully anyway)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM