Added progress
This commit is contained in:
+4
-1
@@ -29,7 +29,7 @@ class Archive {
|
||||
throw new Exception("Error $resp processing tasks");
|
||||
}
|
||||
|
||||
static function upload(File $file, $identifier, $filename, $metadata = []) {
|
||||
static function upload(File $file, $identifier, $filename, $metadata = [], ?Callable $callback = null) {
|
||||
|
||||
$headers = [];
|
||||
$headers[] = "Authorization: LOW " . Config::get("ARCHIVE_KEY") . ":" . Config::get("ARCHIVE_SECRET");
|
||||
@@ -58,6 +58,9 @@ class Archive {
|
||||
|
||||
|
||||
$req = new HTTPRequest();
|
||||
if ($callback) {
|
||||
$req->setCallback($callback);
|
||||
}
|
||||
$resp = $req->put("https://s3.us.archive.org/" . $identifier . "/" . $filename, $file->path(), $headers);
|
||||
|
||||
if ($resp == 200) {
|
||||
|
||||
Reference in New Issue
Block a user