You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is not VichUploader's goal, but I wish it is possible to be true, because VichUploader is too good to process file field and not only in database, but also in template!
the situation is I have a file already in server and I wish it can be save and relocate by VichUploader.
My code in action:
useSymfony\Component\HttpFoundation\File\File;
......
class documentController extendsController {
......
public function updateAction(Request$request){
......
$form = $this->createForm(newDocumentType(), $doc);
........
if ($form->isValid()) {
$baseDir = $this->get('kernel')->getRootDir() . "/../web/uploads";
$fileThumbnail = newFile($baseDir."/image.jpg");
$doc->setImgThumbnail($fileThumbnail->getFilename());
$sm = $this->get('vich_uploader.storage');
$sm->upload($doc);
$em->persist($doc);
$em->flush();
.......
} //eof if
}
}
I try to use VichUploader to save a uploaded file without form class, but it is not work with my way.
I wanna know is it possible save a uploaded file with VichUploader and without Form?
Thanks,
The text was updated successfully, but these errors were encountered:
This won't work (I guess). In order to trigger the upload process you should have an UploadedFile binded to the entity and you're binding a File instance instead.
I know this is not VichUploader's goal, but I wish it is possible to be true, because VichUploader is too good to process file field and not only in database, but also in template!
the situation is I have a file already in server and I wish it can be save and relocate by VichUploader.
My code in action:
I try to use VichUploader to save a uploaded file without form class, but it is not work with my way.
I wanna know is it possible save a uploaded file with VichUploader and without Form?
Thanks,
The text was updated successfully, but these errors were encountered: