I have a controller with a supprimer action.
I can add files and delete them from the database.
As I followed the Symfony doc to create an uploader file, I also created in my services.yml this route
parameters:
repertoire_soumissions: '%kernel.project_dir%/public/uploads/LettresSoumissios'
My problem
When I delete my file with my supprimer action, it's fine it deletes it in my database. But not in my folder /public/uploads/LettresSoumissions. I tried to find a way to be able to delete them in my folder too, but couldn't succeed it.
I tried also with a Filesystem() to remove them, but I've must have written it badly.
Here is my action in my controller class
/**
* @Route("admin/soumission/{id}/supprimer", name="supprimer_soumission")
*/
public function supprimerSoumission(Soumission $soumission, ObjectManager $manager){
$lettresoumission= $soumission->getLettreSoumission();
$filesystem = new Filesystem();
$path='%kernel.project_dir%/public/uploads/LettresSoumissios/'.$lettresoumission;
$filesystem->remove($path);
$manager->remove($soumission);
$manager->flush();
$this->addFlash('success','Soumission supprimer !!');
return $this->redirectToRoute('soumission');
}