Argument 1 passed to App\Service\FileUploader::upload() must be an instance – symfony 4

If you face “Argument 1 passed to App\Service\FileUploader::upload() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, string given, ” this error while playing with files in Symfony 4. Then you need to change your file field in controller as. Change your code from

$file = $task->getTaskLogo(); 
to
$file = $form['task_logo']->getData();
. Where task_logo is the name of the file field of your form.