-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading two fields #35
Comments
Maybe you are doing something wrong, are your entity annotations correct ? can you share with me ? |
namespace CAS\SPA\RealtyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Vich\UploaderBundle\Mapping\Annotation as Vich; /** * CAS\SPA\RealtyBundle\Entity\Projects * @ORM\Entity * @Vich\Uploadable */ class Projects { /** * @var integer $id */ private $id; /** * @var string $name */ private $name; /** * @var string $image_name */ private $image_name; /** * @Assert\File( * maxSize="128k", * mimeTypes={"image/png", "image/jpeg"} * ) * @Vich\UploadableField(mapping="presentation_img", fileNameProperty="image_name") * * @var File $image */ private $image; /** * @var text $discription */ private $discription; /** * @var string $presentation */ private $presentation; /** * @Assert\File( * maxSize="2M", * mimeTypes={"application/pdf", "application/x-pdf"} * ) * @Vich\UploadableField(mapping="pdf_file", fileNameProperty="presentation") * * @var File $file */ private $file; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name * @return Projects */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set image_name * * @param string $imageName * @return Projects */ public function setImageName($imageName) { $this->image_name = $imageName; return $this; } /** * Get image_name * * @return string */ public function getImageName() { return $this->image_name; } /** * Set discription * * @param text $discription * @return Projects */ public function setDiscription($discription) { $this->discription = $discription; return $this; } /** * Get discription * * @return text */ public function getDiscription() { return $this->discription; } /** * Set presentation * * @param string $presentation * @return Projects */ public function setPresentation($presentation) { $this->presentation = $presentation; return $this; } /** * Get presentation * * @return string */ public function getPresentation() { return $this->presentation; } public function setImage($image) { $this -> image = $image; } public function getImage() { return $this -> image; } public function setFile($file) { $this -> presentation = $file; } public function getFile() { return $this -> presentation; } } |
thats my total entity file for the projects table, I'm using yaml for doctrine mapping not annotations. |
image uploads fine, but the file /pdf/ uploads to the temp folder but does not rename. Still |
Same problem as you... did you find a solution ? |
@casoetan maybe you have an error on file property getter and setter. Check this: public function setFile($file) { public function getFile() { |
any updates on this? i got a similar issue One entity, 2 fields |
I never had this problem. There is an entity in my vich-uploader-sandbox with two uploadable fields. Maybe you can use it to check your code. If you still can't make it work, fork my sandbox and try to reproduce the bug in it (so that I can debug it myself). |
Thanks K-Phoen, i make it works like a charm :D |
I had the same issue. And I have emptied my development cache and after that the two files was successfully uploaded ;-) |
The same situation here. Cache clearing solved this problem. |
When i try to upload two files, both in the same entity, but different fields, one is saved correctly and moved into the web directory, but the other is save temporarily in windows temp directory.
How do I fix this? thanks
The text was updated successfully, but these errors were encountered: