-
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
delete_on_update does not remove the original file #1410
Comments
I tried on a project of mine and indeed the old file is not removed. |
Sorry for the late answer. Actually, the listener I propose does work because when I upload a new image, it will be stored as an When executing VichUploaderBundle/src/Handler/UploadHandler.php Lines 108 to 113 in 18c6976
Here, Then, when executing the VichUploaderBundle/src/Handler/UploadHandler.php Lines 67 to 77 in 18c6976
And I call the Finally, the |
Support Question
Hi :)
I have the basic configuration so
delete_on_update
is set totrue
. But when I upload another image, the old one is not deleted. Using the interactive debugger, this is due toVich\UploaderBundle\Handler\UploadHandler::hasUploadedFile()
:The
$file
variable is an instance ofSymfony\Component\HttpFoundation\File\File
so this method always return false.In my opinion, it is impossible to reach this stage as we will never deal with an
UploadedFile
here because the file has already been moved and so converted into itsFile
instance (which is reported here but is normally fixed). I have overcome this problem using the custom listener below but I think I have missed somthing with thedelete_on_update
option.Here is the relevant part of my entity
Article
:And here is the yaml config :
The text was updated successfully, but these errors were encountered: