/** * Get the headers needed before transferring the content of a POST file. * * @param FacebookFile $file * * @return string */ protected function getFileHeaders(FacebookFile $file) { return "\r\nContent-Type: {$file->getMimetype()}"; }
public function testPartialFilesCanBeCreated() { $file = new FacebookFile($this->testFile, 14, 5); $fileContents = $file->getContents(); $this->assertEquals('is a text file', $fileContents); }
/** * Upload by chunks - start phase * * @param string $endpoint * @param FacebookFile $file * * @return FacebookTransferChunk * * @throws FacebookSDKException */ public function start($endpoint, FacebookFile $file) { $params = ['upload_phase' => 'start', 'file_size' => $file->getSize()]; $response = $this->sendUploadRequest($endpoint, $params); return new FacebookTransferChunk($file, $response['upload_session_id'], $response['video_id'], $response['start_offset'], $response['end_offset']); }
public function testCanOpenAndReadAndCloseAFile() { $file = new FacebookFile($this->testFile); $fileContents = $file->getContents(); $this->assertEquals('This is a text file used for testing. Let\'s dance.', $fileContents); }