I used comurimage to download an image. my problem is that I could not get the original file name.
->add('logo', CroppableImageType::class, array('label' => 'image', 'required' => false,
'uploadConfig' => array(
'uploadUrl' => $myEntity->getUploadDir(), // required - see explanation below (you can also put just a dir path)
'webDir' => $myEntity->getUploadRootDir(), // required - see explanation below (you can also put just a dir path)
'fileExt' => '*.jpg;*.gif;*.png;*.jpeg', // required - see explanation below (you can also put just a dir path)
'showLibrary' => false,
),
'cropConfig' => array(
'minWidth' => 380,
'minHeight' => 300,
'aspectRatio' => true, //optional
'cropRoute' => 'comur_api_crop', //optional
'forceResize' => false, //optional
'thumbs' => array(//optional
array(
'maxWidth' => 588,
'maxHeight' => 400,
//optional
)
))));
controller: $file = $project->getLogo(); //var_dump($file); $file_name = substr($file, 8, strlen($file));
twig
<div class="row">
<div class="col-sm-8">
{{ form_errors(formProject.logo) }}
{{ form_widget(formProject.logo) }}
</div>
</div>