好像我跟着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);
});
}
});
无济于事。有谁知道我在这里做错了什么?
答案 0 :(得分:0)
{% javascripts
'bundles/path/to/the/js/assets/*.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}