0

I'm having trouble uploading a file to facebook with PHP versions before 5.5 where CURLFile class is not available.

As I understand, I should use @filepath as the source and that should work, but for some reason it returns

Exception occured, code: 353 with message: (#353) You must select a video file to upload.

I've tried sending the path using realpath() function, that doesn't work.

$response = (new FacebookRequest(
                  $session, 'POST', '/me/videos', array(
                    'source' => '@'.realpath($url),                
                    'description' => $description,
                    'title' => $title
                  )
                ))->execute()->getGraphObject();

Does anyone have a solution for this?

4
  • I've also tried setting fileUpload to true in the parameters, that didn't work either.
    – lnenad
    Jun 10, 2015 at 14:11
  • Have you checked the return value of realpath($url)? Is it actually a local file? (And if so, why is the variable named $url …?)
    – CBroe
    Jun 10, 2015 at 21:01
  • It is, yes, full path to the local file, I have also tried hardcoding it, I don't know what to tell you about the variable name, that's how it's named.
    – lnenad
    Jun 11, 2015 at 11:33
  • 1
    Can you try if uploading a photo as described in this example developers.facebook.com/docs/php/howto/uploadphoto/4.0.0 works? If that works with the 'source' => '@/path/to/file.name' syntax, but for videos it doesn’t, then this might be a bug.
    – CBroe
    Jun 11, 2015 at 12:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.