无法上传IE9文件 - Blueimp

时间:2015-08-13 17:59:11

标签: jquery angularjs internet-explorer file-upload blueimp

我有以下逻辑来初始化blueimp上传器

                el.fileupload({
                    url: '/media',
                    formData: formData,
                    progressInterval: 300,
                    forceIframeTransport : true, //!window.FormData, temp hack to replicate IE functionality on chrome
                    uploadTemplateId: null,
                    downloadTemplateId: null,
                    singleFileUploads: !scope.config.multiple,
                    change: change,
                    progress: progress,
                    beforeSend: beforeSend,
                    add: add
                });

                el.find('.file-uploader').bind('change', function (e) {
                    el.fileupload('add', {
                        fileInput: $(this) //for ie iframe upload
                    });
                });

这就是我的HTML(上面代码中的el)的样子:

<form id="fileupload">
    <div class="row fileupload-buttonbar">
        <div>
            <span class="btn btn-success fileinput-button">
                    <i class="glyphicon glyphicon-plus"></i>
                    <span>Add files...</span>
                    <input type="file" name="file" ng-disabled="disabled" class="file-uploader">
            </span>
            <button type="button" class="btn btn-primary start" ng-if="!config.autoUpload" data-ng-click="submit()">
                <i class="glyphicon glyphicon-upload"></i>
                <span>Start upload</span>
            </button>
            <button type="button" class="btn btn-warning cancel" data-ng-click="cancel()">
                <i class="glyphicon glyphicon-ban-circle"></i>
                <span>Cancel upload</span>
            </button>
        </div>

    </div>
</form>

现在当我上传时,我看不到正在发送的文件,在调查jQuery Iframe Transport Plugin 1.8.3第143行时,options.fileInput附加了输入元素,但files属性就在其上长度为0.因此,我将以下内容视为发送到服务器的数据:

------WebKitFormBoundarypfHR2vjNiSu5Y9G8
Content-Disposition: form-data; name="jsonString"

{"name":"1439488201502"}
------WebKitFormBoundarypfHR2vjNiSu5Y9G8
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundarypfHR2vjNiSu5Y9G8--

上面的文件名为空,内容类型为application/octet-stream,而不是image/jpeg

感谢任何帮助。

0 个答案:

没有答案
相关问题