Can't send local file
Closed this issue · 4 comments
Hi folks!
I'm losing my mind trying to figure out how to send a file from local.
I've try to use the ImageMessage like this:
$imageMessage = new ImageMessage($this->fbUser->psui, $filePath);
But I've always this error:
(#100) Failed to fetch the file from the url
Maybe because in the ImageMessage.php file at line 71 there is an error.
$attachment->setPayload(array('url' => basename($this->text)));
Maybe must be
$attachment->setPayload(array('is_reusable' => $this->is_reusable ));
(but the is_reusable parameters don't exists).
Even changing that line I've always have this error:
(#100) Incorrect number of files uploaded. Must upload exactly one file.
This is the data I'm posting:
array ( 'recipient' => array ( 'id' => 'XXX', ), 'notification_type' => 'REGULAR', 'messaging_type' => 'RESPONSE', 'message' => array ( 'attachment' => array ( 'type' => 'image', 'payload' => array ( 'is_reusable' => false, ), ), ), 'filedata' => CURLFile::__set_state(array( 'name' => '/tmp/filename.jpeg', 'mime' => 'image/jpeg', 'postname' => 'filename.jpeg', )), )
The file exists and have 777 as permissions.
Any idea?
Thanks!
\m
Yes, I've tried with a 400KB file :)
Is this ticket still relevant?
I haven't tried to see if the bug is still to fix, but I don't need it anymore thanks :)