} else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } //Check is user choose upload local file if ($_FILES['file']["name"] != "") { //Temp name of the file $tmpName = $file['tmp_name']; //Original name of the file $name = $file['name']; //Creat file stream $fs = FileStream::fromFile($tmpName); //###Make a request to Storage API using clientId //Upload file to current user storage try { $uploadResult = $storageApi->Upload($clientId, $name, 'uploaded', "", 0, $fs); //###Check if file uploaded successfully if ($uploadResult->status == "Ok") { //Get file GUID $fileGuId = $uploadResult->result->guid; $fileId = ""; //If it isn't uploaded throw exception to template } else { throw new Exception($uploadResult->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n";
protected function setUp() { $this->fs = FileStream::fromFile(dirname(__FILE__) . "/resources/test.doc"); }