2

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?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
viko
  • 491
  • 6
  • 23

0 Answers0