Bonjour,

J'essaye d'utiliser l'extension gedmo uploadable, j'ai cherche sur le netmais je ne trouve pas de solution

J'ai suivi l'exemple de la doc https://github.com/stof/StofDoctrine...able-extension.

Lorsque je submite mon formulaire, un enregistrement se crée dans ma table mais je n'ai aucun fichier uploadé

Voici mon entite :
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
<?php
namespace Test\IllustrationBundle\Entity;
 
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
 
/**
 * @ORM\Entity
 * @Gedmo\Uploadable(path="/uploads/illustration", 
 filenameGenerator="SHA1",
 allowOverwrite=true)
 */
class File
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;
 
    /**
     * @ORM\Column(name="path", type="string", nullable=true)
     * @Gedmo\UploadableFilePath
     */
    private $path;
 
     /**
     * @ORM\Column(name="name", type="string", nullable=true)
     * @Gedmo\UploadableFilename
     */
    private $name;
 
 
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
 
    /**
     * Set path
     *
     * @param string $path
     * @return File
     */
    public function setPath($path)
    {
        $this->path = $path;
 
        return $this;
    }
 
    /**
     * Get path
     *
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }
 
 
 
    /**
     * Set name
     *
     * @param string $name
     * @return File
     */
    public function setName($name)
    {
        $this->name = $name;
 
        return $this;
    }
 
    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}
et mon controler
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
public function testfileAction(Request $request)
    {
 
        $document = new File();
    $form = $this->createFormBuilder($document)
        ->add('name')
        ->add('path','file',array(
                    'data_class' => null ))
        ->add('submit','submit')
        ->getForm()
    ;
 
    if ($this->getRequest()->getMethod() === 'POST') {
 
        $form->handleRequest($this->getRequest());
 
 
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
 
            $em->persist($document);
 
 
            $uploadableManager = $this->get('stof_doctrine_extensions.uploadable.manager');
 
            $uploadableManager->markEntityToUpload($document, $document->getPath());
 
            $em->flush();
 
 
        }
    }
De plus dans ma table file, le path est celui du fichier temporaire C:\wamp\tmp\php49F0.tmp


Une idée ?

Merci de votre aide