if I print the contents of the UploadedFile instance, this is what I get
array ( 'opt_image_header' => Symfony\Component\HttpFoundation\File\UploadedFile::__set_state(array( 'test' => false, 'originalName' => 'triangle-in-the-mountains.jpg', 'mimeType' => 'image/jpeg', 'size' => 463833, 'error' => 0, )
And this is how I get the downloaded file in the controller. Before moving it, I have to resize it.
foreach($request->files as $uploadedFile){ $ext = '.' . $uploadedFile['opt_image_header']->guessExtension(); $filename = sha1(uniqid(mt_rand(), true)) . $ext; $uploadedFile['opt_image_header']->move($path . '/images/', $filename); }
so there is no "tmp_name" that I need to resize the image before saving it.
Do I need to read it directly from the $ _FILE array?
upload image symfony
Carlo
source share