I used OneupUploaderBundle
, fronted: jQuery-File-Upload
.
Now, I can upload file and add records to entity, but default, doesn't show all uploaded files. When I added files to list and clicked "Start Upload", I can see the files in the list, after refresh, list is erased.
public function onUpload(PostPersistEvent $event)
{
$file = $event->getFile();
$response = $event->getResponse();
$object = new file();
$object->setFilename($file->getPathName());
$this->manager->persist($object);
$this->manager->flush();
//$files = $this->getFiles($request->files);
$response['files']= array(
array(
'name' => $file->getPathName(),
'url' => $file->getPathName()
)
);
}
Do I need to use other method to response?