Search code examples
internet-explorerjpegfine-uploader

fineuploader jpg not working in IE


I am not able to upload images with fineuploader in IE. Works in chorme and FireFox.

Any idea why uploading jpg in IE would not work. I noticed that chrome request object Context type is "application/octet-stream" while IE is not. Is this the issue if so what do i change to get the fineuploader to use this context type in request.

Thanks // Setup the uploader. if (document.getElementById('formUpload')) { var description = ""; var fileName = ""; var fileUploader = new qq.FileUploader({

            allowedExtensions: viewModel.AllowedFileExt(),
            element: document.getElementById('formUpload'),
            action: '../Upload/UploadHandler.ashx',
            params: {
                submissionNumber: function () {
                    submissionNumber = $("#SubmissionNumber").val();
                    return submissionNumber;
                },
                fileName: function () {
                    fileName = $(".qq-upload-file").text();
                    return fileName;
                },
                description: function () {
                    description = $("#txtAttachmentDesciption").val();
                    return description;
                }
            },
            onComplete: function (id, fileName, responseJSON) {
                $("#attachedFiles").html("");
                loadAttachments($("#Number").val());
            },
            onSubmit: function (id, fileName) {
                fileUploader.filesSelectedForUpload = 1;

            },
            autoUpload: false,
            multiple: false
        });
        fileUploader.filesSelectedForUpload = 0;
    }

Solution

  • the problem was server-side. when in IE use "context.Request.Files["qqfile"].InputStream" not context.Request.InputStream

    //if IE
    var buffer = new byte[context.Request.ContentLength];
                using (var br = new BinaryReader(context.Request.Files["qqfile"].InputStream))
                    br.Read(buffer, 0, buffer.Length);
    //ELSE
    
    var buffer = new byte[context.Request.ContentLength];
                using (var br = new BinaryReader(context.Request.InputStream))
                    br.Read(buffer, 0, buffer.Length);