문제

I am having to ditch uploadify in favour of jQueryFileUpload to accommodate non-Flash mobile users on a web app. However, my upload.ashx handler does not receive anything in the post from jQuery.

$('#fileupload').fileupload({
            autoUpload: true,
            dataType: 'json',
            url: webroot + 'handlers/Upload.ashx',
            done: function (e, data) {
                $.each(data.result.files, function (index, file) {
                    $('<p/>').text(file.name).appendTo('#files');
                });
            }
        });

The Handler code:

public void ProcessRequest (HttpContext context) {
    HttpPostedFile postedFile = context.Request.Files["Filedata"];
}

Why does postedFile return null?

도움이 되었습니까?

해결책

I figured it out:

HttpPostedFile postedFile = context.Request.Files.Get(0) as HttpPostedFile;

simples

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top