upload file using jquery and handler(ashx)

后端 未结 3 917
小蘑菇
小蘑菇 2020-12-29 13:27

I am trying to upload a file using jquery ajax with handler (c#). The problem is, when I call the handler I get

context.Request.File.Count=0
3条回答
  •  时光说笑
    2020-12-29 13:43

    Your code...

    $.ajax({
        type: "POST",
        url: "Services/UPloader.ashx",
        contentType: "application/json; charset=utf-8",
        success: OnComplete,
        error: OnFail
    });
    

    ..is missing the data parameter. The way it's currently written, nothing is being sent to the handler.

    You need to pass the file to the handler, using the data parameter. Please have a go through this link: http://www.aspdotnet-suresh.com/2015/02/jquery-upload-images-files-without-page-refresh-postaback-in-aspnet.html

提交回复
热议问题