mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-07-06 13:01:33 -07:00
Allows for object parameters be set on text upload (#55)
The default ContentType is 'application/octet-stream' which forces files to be downloaded instead of opened by the browser. Setting the ContentType to match the file mime type takes care of it. //Example $my_space->upload( 'world', "hello.txt", "public", array('ContentType' => 'text/plain')); $my_space->upload( $imageBlob, "happy.jpg", "public", array('ContentType' => 'image/jpeg')); //Other Uses array('CacheControl' => 'max-age=60', 'ContentEncoding' => 'gzip'); //Source https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html
This commit is contained in:
parent
39063d7831
commit
627ce8a867
1 changed files with 2 additions and 2 deletions
|
@ -150,10 +150,10 @@ class Space {
|
||||||
/*
|
/*
|
||||||
Uploads text.
|
Uploads text.
|
||||||
*/
|
*/
|
||||||
function upload($text, $saveAs, $privacy = "private") {
|
function upload($text, $saveAs, $privacy = "private", $params = array()) {
|
||||||
if($privacy == "public") { $privacy = "public-read"; }
|
if($privacy == "public") { $privacy = "public-read"; }
|
||||||
|
|
||||||
return SpacesResult($this->s3->upload($this->name, $saveAs, $text, $privacy));
|
return SpacesResult($this->s3->upload($this->name, $saveAs, $text, $privacy, array( 'params' => $params)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue