VichUploaderBundle ile nasıl dosya oluşturabilirim?Symfony2: VichUploaderBundle ile manuel dosya yükleme
Bazı dizinde dosya bu denerseniz
(örneğin web/media/tmp/temp_file.jpg
için):
$file = new UploadedFile($path, $filename);
$image = new Image();
$image->setImageFile($file);
$em->persist($image);
$em->flush();
bende bu hatayı:
The file "temp_file.jpg" was not uploaded due to an unknown error.
ben dosya yüklemek için gerek uzak URL’den. Bu yüzden tmp
direcotry (curl ile) dosyasına dosya yüklüyorum ve daha sonra onu (yukarıda gördüğünüz gibi) VichUploadBundle'a enjekte etmeye çalışıyorum.
Oh, bundan korkuyordum. Ama önemli değil, başka bir şey öğreneceğim. Çok teşekkür ederim! –