Closed fd6130 closed 4 years ago
I'm using Symfony 4.4 and i found this issue when tried upload each photo through foreach loop:
$request->files is $_FILES in PHP
$request->files
$_FILES
/** * @var images[] $request->files->get('images') */ foreach($request->files->get('images') as $image) { $response = $fb->post('/{page-id}/photos', [ 'source' => $fb->fileToUpload($image), 'published' => 'false' ]); $graphNode = $response->getGraphNode(); // .... }
It give me error like Failed to create FacebookFile entity. Unable to read resource: /tmp/phpInUGiA.
Failed to create FacebookFile entity. Unable to read resource: /tmp/phpInUGiA.
But when i try upload single photo (select one photo and upload it), it have no problem:
$response = $fb->post('/{page-id}/photos', [ 'source' => $fb->fileToUpload($request->files->get('images')), 'published' => 'false' ]); $graphNode = $response->getGraphNode(); // ....
This one success.
Do we have any solution to deal with this issue?
I found a solution for this.
I use VichUploader upload all the images, and then use UploaderHelper to get the path of the image.
And it seems works now.
I'm using Symfony 4.4 and i found this issue when tried upload each photo through foreach loop:
$request->files
is$_FILES
in PHPIt give me error like
Failed to create FacebookFile entity. Unable to read resource: /tmp/phpInUGiA.
But when i try upload single photo (select one photo and upload it), it have no problem:
This one success.
Do we have any solution to deal with this issue?