Beispiel #1
0
 public static function uploadFile(Zotero_StorageFileInfo $info, $file, $contentType)
 {
     Zotero_S3::requireLibrary();
     S3::setAuth(Z_CONFIG::$S3_ACCESS_KEY, Z_CONFIG::$S3_SECRET_KEY);
     if (!file_exists($file)) {
         throw new Exception("File '{$file}' does not exist");
     }
     $success = S3::putObject(S3::inputFile($file), Z_CONFIG::$S3_BUCKET, self::getPathPrefix($info->hash, $info->zip) . $info->filename, S3::ACL_PRIVATE, array(), array("Content-Type" => $contentType));
     if (!$success) {
         return false;
     }
     return self::addFile($info);
 }