Bonjour,
J'ai suivi le tuto pour l'upload d'image de la doc Symfony (http://symfony.com/doc/2.0/cookbook/...e_uploads.html) et celui là : http://leny-bernard.com/fr/afficher/...fony2-partie-4
Par contre, lorsque j'upload, je reçois ce message d'erreur :
Fatal error: Call to a member function move() on a non-object in /home/xxxx/public_html/src/Site/MonBundle/Entity/Photo.php on line 209
Voici mon fichier Photo.php : http://pastebin.com/C8MsSHXY
La fonction qui pose problème :
Merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 /** * @ORM\PrePersist() * @ORM\PreUpdate() */ public function uploadFile() { // the file property can be empty if the field is not required if (null === $this->file) { return; } if(!$this->id){ $this->file->move($this->getTmpUploadRootDir(), $this->file->getClientOriginalName()); }else{ $this->file->move($this->getUploadRootDir(), $this->file->getClientOriginalName()); } $this->setFile($this->file->getClientOriginalName()); }







Répondre avec citation

Partager