Batch 6a: application controllers base
This commit is contained in:
33
application/controllers/test/S3_api.php
Normal file
33
application/controllers/test/S3_api.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
class S3_api extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library("Sas_s3");
|
||||
}
|
||||
function create_bucket($bucket)
|
||||
{
|
||||
$resp = $this->sas_s3->create_bucket($bucket);
|
||||
}
|
||||
function upload_file()
|
||||
{
|
||||
// global $_POST, $_FILES;
|
||||
// $input_file= $_FILES["files"];
|
||||
// $key = $_POST["xid"]. "-" . $input_file["name"];
|
||||
// $contents = file_get_contents($input_file["tmp_name"]);
|
||||
// $content_type = $input_file["type"];
|
||||
$key = "xxid.txt";
|
||||
$bucket = "audio-sample";
|
||||
$content_type = "text/plain";
|
||||
$contents = "this is a test only";
|
||||
$resp = $this->sas_s3->upload($bucket, $key, $content_type, $contents);
|
||||
echo "status : " . $resp['@metadata']['statusCode'];
|
||||
print_r($resp);
|
||||
}
|
||||
function get_url($bucket, $xid)
|
||||
{
|
||||
$resp = $this->sas_s3->show_url($bucket, $xid, "30 seconds");
|
||||
echo $resp . "\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user