Questions tagged [vichuploaderbundle]

A simple Symfony2 bundle to ease file uploads with ORM entities, MongoDB ODM documents, PHPCR ODM documents or Propel models.

The VichUploaderBundle is a bundle that attempts to ease file uploads that are attached to ORM entities, MongoDB ODM documents, PHPCR ODM documents or Propel models.

  • Automatically name and save a file to a configured directory
  • Inject the file back into the entity or document when it is loaded from the datastore as an instance of Symfony\Component\HttpFoundation\File\File
  • Delete the file from the file system upon removal of the entity or document from the datastore
  • Templating helpers to generate public URLs to the file

All of this functionality is fully configurable to allow for app-specific customization

If your question matches problems described in the bulletlist below then use this tag.

Project page

253 questions
17
votes
6 answers

How to use Vich uploader with easyAdmin 3 on Symfony 5

I've been trying to use VichUploader to upload files on a Symfony project, already using EasyAdmin 3. I've configured everything correctly, but I'm getting this error: The "pieceJointeFile" image field must define the directory where the images are…
Chedi Athmni
  • 213
  • 1
  • 2
  • 7
11
votes
1 answer

Symfony - API Platform - File Upload

I'm trying to implement a file upload with API PLatform following the Documentation using Vich. But it's not working, precisely, the MediaObject is not hydrated by the file I send on my request. I followed quite exactly the cookbook provided by API…
10
votes
2 answers

Api platform handling fille uploads

I'm trying to upload files with Api Platform and Vich Uploader Bundle. When I send POST request with multipart/form-data and Id of the entity to attach image file to, I get 200 response with my entity. But uploaded file doesn't uploads to…
Andrey Kryukov
  • 765
  • 1
  • 10
  • 23
10
votes
5 answers

How to use mimeType Assert with VichUploader?

This assert is passing Symfony's form validation when uploading any file with VichUploaderBundle: /** * @Vich\UploadableField(mapping="product_media", fileNameProperty="path") * @Assert\File( * mimeTypes = {"image/jpeg", "image/gif",…
TMichel
  • 4,336
  • 9
  • 44
  • 67
9
votes
1 answer

VichUploaderBundle- expected argument of type "AppBundle\Entity\File", "Symfony\Component\HttpFoundation\File\UploadedFile" given

I followed the instruction: https://github.com/dustin10/VichUploaderBundle/blob/master/Resources/doc/usage.md to the letter but I'm getting the following error while saving User entity: Expected argument of type "AppBundle\Entity\File",…
Torpedr
  • 137
  • 3
  • 10
9
votes
2 answers

Symfony VichUploaderBundle rename file

Hi is there a way to rename uploaded file using VichUploaderBundle? If I upload two image with same name it will remove the old one and it's a problem for me. I have configuration exactly the same like in the doc
H.W.
  • 343
  • 1
  • 5
  • 21
8
votes
4 answers

Symfony2: manual file upload with VichUploaderBundle

How can I upload file with VichUploaderBundle without form? I have file in some directory (for example web/media/tmp/temp_file.jpg) If I try this: $file = new UploadedFile($path, $filename); $image = new…
Tomas S.
  • 329
  • 2
  • 9
7
votes
1 answer

VichUploaderBundle - namer: Parent definition does not exist

config.yml vich_uploader: db_driver: orm mappings: media_image: uri_prefix: '%uploads_dir%' upload_destination: '%kernel.root_dir%/../web/uploads/images' namer:…
breq
  • 24,412
  • 26
  • 65
  • 106
7
votes
4 answers

Symfony VichUploaderBundle: File name could not be generated

I am using VichUploader to upload files within a symfony project. In configuration i use (copied from documentation): service: vich_uploader.namer_property options: { property: 'slug'} In my entity i generate the slugs automatically with…
Nicki
  • 313
  • 4
  • 14
6
votes
2 answers

base64 image to image file with Symfony and VichUploader

In symfony, I have an entity Program, which has the attribute image. Uploading images, naming them and putting them in the right directory is done with the VichUploaderBundle. The entity looks like this: //... /** * NOTE: This is not a mapped…
Dirk J. Faber
  • 4,360
  • 5
  • 20
  • 58
6
votes
1 answer

How to upload an image using angular + symfony + vichuploaderBundle

I'm trying to upload an image using angular and vichUploaderBundle for symfony. The idea is the following, I have some tabs, if you click on them they'll display different forms, one of them is for file uploading. My question is, How can I upload…
Mauro Alvarez
  • 550
  • 6
  • 27
5
votes
1 answer

Symfony3: "The file /tmp/php4k3bf8 could not be accessed"

I am getting the error message "The file /tmp/php4k3bf8 could not be accessed" when uploading a file. See here the full error log. [2017-08-13 15:50:29] request.INFO: Matched route "apply_for_job".…
xfscrypt
  • 16
  • 5
  • 28
  • 59
5
votes
1 answer

Data fixtures with VichUploader bundle in Symfony3

A basic Symfony 3 application has the VichUploader bundle installed and configured, with an entity for uploading files against. How do I attach a file to this entity in my ORM data fixtures? There is a question for this problem in Symfony 2 and I…
NoChecksum
  • 1,206
  • 1
  • 14
  • 31
4
votes
1 answer

VichUploaderBundle in Symfony 6

I hope you can help me because i'm searching and i'm lost :( I'm trying to upload image in my symfony 6 project with VichUploaderBundle. I used the doc :…
4
votes
3 answers

Symfony / API Platform - Custom Operation - PUT method for file replacement using VichUploaderBundle

I am using Vich Uploader Bundle in combination with API Platform to store files. I've followed the instructions from the official documentation https://api-platform.com/docs/core/file-upload/#handling-file-upload Everything works well except I want…
9lex
  • 131
  • 6
1
2 3
16 17