Uploading file to Amazon s3 bucket using CodeIgniter - php
- Create Amazon S3 account
- Create a bucket for the files
- Get Amazon S3 access key and secret key
- Edit config/config.php with your appropriate settings
- Copy config/s3.php and library files to your CI installation
- Edit config/s3.php with your appropriate settings
// Load Library
$this->load->library('s3_upload');
// Upload file
$file = APPPATH.'public/img/image1.jpg';
$file_url = $this->s3_upload->upload_file($file);
var_dump($file_url);
//string(76) "https://bucket_name.amazonaws.com/bucket_name/folder_name/image1-50.jpg"