/** * Extracts the files from a request. * * @param FacebookRequest $request * * @return string|null * * @throws FacebookSDKException */ public function extractFileAttachments(FacebookRequest $request) { if (!$request->containsFileUploads()) { return null; } $files = $request->getFiles(); $fileNames = []; foreach ($files as $file) { $fileName = uniqid(); $this->addFile($fileName, $file); $fileNames[] = $fileName; } $request->resetFiles(); // @TODO Does Graph support multiple uploads on one endpoint? return implode(',', $fileNames); }