Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Resumable upload to fb page returns error "There was a problem uploading your video. Please try again." code : 6001 #1000

Closed
@sai905905

Description

@sai905905

try {
$response = $fb->uploadVideo('me', $videoPath, $data, $token);

    } catch (FacebookResponseException $e) {

        // When Graph returns an error
        return 'error_code-'. $e->getCode() . ' ' . $e->getMessage();

    } catch (FacebookSDKException $e) {

        // When validation fails or other local issues
        return 'error_code-'. $e->getCode() . ' ' . $e->getMessage();

    }

********************* SDK RESUMABLE UPLOAD CODE********************

public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;

    $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
    $endpoint = '/'.$target.'/videos';
    $file = $this->videoToUpload($pathToFile);
    $chunk = $uploader->start($endpoint, $file);

    do {
        $chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries);
    } while (!$chunk->isLastChunk());

    return [
      'video_id' => $chunk->getVideoId(),
      'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
    ];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions