image - How to load datafixtures with files in symfony3 -
i want load datafixtures doctrinefixturesbundle images don't know how make work.
i tried 1 :
public function load(objectmanager $manager) { $imagegrabtail = new image(); $imagegrabtail->settrick($this->getreference('grab-tail')); $imagegrabtail->setupdatedat(new \datetimeimmutable()); $file = new uploadedfile($imagegrabtail->getuploaddir() . '/63.jpeg', 'image1', null, null, null); $imagegrabtail->setfile($file); $manager->persist($imagegrabtail); $manager->flush(); } my method getuploaddir():
public function getuploaddir() { return 'uploads/img'; } but have error :
[symfony\component\httpfoundation\file\exception\filenotfoundexception] file "uploads/img/63.jpeg" not exist my file 63.jpeg exists on folder.
is there can explain me why it's not working ?
thanks !
this object uploadedfile file upload through request. here there no request, have use get_file_contents() function in order access data. try function , tell result of it.
Comments
Post a Comment