jQuery文件上传预览图像不起作用

时间:2013-09-05 11:05:15

标签: javascript jquery jquery-plugins

我正在使用jQuery File Upload,在上传之前,所有内容都与图像预览分开。

我添加了所有JS文件,例如demo和相同的JS.ie页脚:

<script src="/assets/jquery/jquery-1.10.2.js"></script>
<script src="/assets/jquery/jquery-ui.js"></script>
<script src="/assets/twitter/bootstrap.js"></script>
<script src="/assets/load-image.min.js"></script>
<script src="/assets/tmpl.min.js"></script>
<script src="/assets/canvas-to-blob.min.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.iframe-transport.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.fileupload.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.fileupload-process.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.fileupload-image.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.fileupload-validate.js"></script>
<script src="/assets/jquery/plugins/upload/jquery.fileupload-ui.js"></script>
<script src="/assets/flatui/flatui-checkbox.js"></script>
<script src="/assets/backend.upload.js"></script>

在上传JS中我有:

$(function () {
    'use strict';

    // Initialize the jQuery File Upload widget:
    $('#fileupload').fileupload({
        url: 'photos',
        maxFileSize: 5000000,
        acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
    });

    // Enable iframe cross-domain access via redirect option:
    $('#fileupload').fileupload(
        'option',
        'redirect',
        window.location.href.replace(
            /\/[^\/]*$/,
            '/cors/result.html?%s'
        )
    );


        // Load existing files:
    $('#fileupload').addClass('fileupload-processing');
    $.ajax({
        // Uncomment the following to send cross-domain cookies:
        //xhrFields: {withCredentials: true},
        url: $('#fileupload').fileupload('option', 'url'),
        dataType: 'json',
        context: $('#fileupload')[0]
    }).always(function () {
        $(this).removeClass('fileupload-processing');
    }).done(function (result) {
        $(this).fileupload('option', 'done').call(this, null, {result: result});
    });

});

这是HTML的GIST:https://gist.github.com/weblee/6449018

我也没有得到控制台错误。有什么建议吗?

此处正在进行中:http://screencast.com/t/HPQgdUsW

0 个答案:

没有答案