我将 OneUp 包用于 symfony 2,方法的侦听器类从不调用
//service.yml
amd_picture.uploadListener:
class: Amd\PictureBundle\Services\UploadListener
arguments: ["@doctrine.orm.entity_manager"]
tag:
- {name: kernel.event_listener, event: oneup_uploader.post_chunk_upload, method: onUpload}
监听类实现了onUpload方法和对应的事件,是不是应该监听的事件???
class UploadListener {
private $doctrine;
public function __construct($doctrine) {
$this->doctrine = $doctrine;
}
public function onUpload(PostChunkUploadEvent $event) {
//source code
}
}
前端模板的脚本
<script>
YUI().use('uploader', function(Y) {
var uploader = new Y.Uploader(
{
multipleFiles: true,
uploadURL: "{{ oneup_uploader_endpoint('gallery') }}",
width: "300px",
height: "60px"
}).render("#fileupload");
</script>
我不明白为什么永远不会调用 onUpload 方法?