Support content type for UploadFile().

This commit is contained in:
Mark Ruys 2018-09-15 22:15:14 +02:00
parent 6301cb1adb
commit 0addc2cf7b

View file

@ -252,7 +252,7 @@ class SpacesConnect {
/* /*
Upload a file. Upload a file.
*/ */
function UploadFile($pathToFile, $access = "private", $save_as = "") { function UploadFile($pathToFile, $access = "private", $save_as = "", $mime_type = "application/octet-stream") {
if(empty($save_as)) { if(empty($save_as)) {
$save_as = $pathToFile; $save_as = $pathToFile;
} }
@ -266,10 +266,11 @@ class SpacesConnect {
} }
try { try {
$result = $this->client->putObject(array( $result = $this->client->putObject(array(
'Bucket' => $this->space, 'Bucket' => $this->space,
'Key' => $save_as, 'Key' => $save_as,
'Body' => $file, 'Body' => $file,
"ACL" => $access 'ACL' => $access,
'ContentType' => $mime_type
)); ));
$this->client->waitUntil('ObjectExists', array( $this->client->waitUntil('ObjectExists', array(