无法将jQuery文件上传到oneupUploader包中

时间:2015-05-17 15:39:44

标签: symfony jquery-file-upload oneupuploaderbundle

好像我跟着docs跟着这封信,但是我无法使用symfony2中的oneupUploader包来上传jQuery文件。没有错误显示,浏览器控制台中没有任何内容,没有任何反应。

我试过这个:

{% block javascripts %}

{% javascripts '@OOTNBlogBundle/Resources/public/js/jquery-file-upload/js/vendor/jquery.ui.widget.js'
               '@OOTNBlogBundle/Resources/public/js/jquery-file-upload/js/jquery.iframe-transport.js'
               '@OOTNBlogBundle/Resources/public/js/jquery-file-upload/js/jquery.fileupload.js' %}

<script src="{{ asset_url }}"></script>
{% endjavascripts %}

<script type="text/javascript">

$(document).ready(function() {
    $('#fileupload').fileupload({});
});

</script>

{% endblock %}

{% block content %}

<input id="fileupload" type="file" name="files[]" data-url="{{ oneup_uploader_endpoint('gallery') }}" multiple />

// ..

(jQuery包含在父模板中)。阅读this question后,我尝试用

替换$('#fileupload').fileupload({});
$('#fileupload').fileupload({
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
            $('<p/>').text(file.name).appendTo(document.body);
        });
    }
});

无济于事。有谁知道我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

{% javascripts
    'bundles/path/to/the/js/assets/*.js'
%}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}