dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.83k stars 519 forks source link

Using pure Annotation Does not Upload the actual file. @Vich\UploadableField #1438

Closed l0r3nc335 closed 6 months ago

l0r3nc335 commented 6 months ago

Bug Report

Q A
Bundle version 2.3.1
Symfony version 5.4^
PHP version 8.1.2

Summary

Current behavior

Using pure @Vich\Uploadable and @Vich\UploadableField(mapping="images", fileNameProperty="url") Does not upload the temp file to the public/images directory.

And works if I add #[Vich\Uploadable] and #[Vich\UploadableField(mapping: 'images', fileNameProperty: 'url')] the annotation above

garak commented 6 months ago

Use the attributes then

l0r3nc335 commented 6 months ago

Use the attributes then

what happened to the annotation? use Vich\UploaderBundle\Mapping\Annotation as Vich;

julienmiclo commented 6 months ago

Since 2.0, you need to do this : the new default type for mapping is "attribute". You can still use annotations, but you need an explicit definition (set "annotation" as value for "vich_uploader.metadata.type" config key)