Question

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?

Was it helpful?

Solution

I figured it out:

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

simples

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top