似乎我按照文档的信,但我不能得到jQuery文件上传工作使用symfony2中的oneupUploader包。没有错误显示,浏览器控制台中没有任何内容,没有任何事情发生。
我试过了:
{% 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包含在父模板中)。在阅读了这个问题之后,我尝试用
替换$('#fileupload').fileupload({});
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
无效。有人知道我哪里做错了吗?
{% javascripts
'bundles/path/to/the/js/assets/*.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}