- Simplified Chinese
- Traditional Chinese
CodeIgniter AWS S3 Integration is a CodeIgniter Library which provides an easy way to integrate AWS S3 in a CodeIgniter project.
Using this library you can use the S3(Simple Storage Service by Amazon) bucket as a storage for user uploaded files in your Codeigniter project. It was never easy to use S3 as a storage media for your Codeigniter Project before this library, It will hardly take 5 minutes in integration. It will simply save you several hours of time for the integration.
Note: In order to use S3 as a storage you do not need to host your project on AWS. You can use S3 service from any hosting server, even from your local Server too.
Looking forward to use S3 in your existing CodeIgniter system to scale with low cost storage?
If yes than It’s easiest way to achieve that!
- Easy configuration.
- Extended Codeigniter upload library so things are easy to use and understand, keeping you in context
- Use of single function to use S3 as Storage instead of web-server for uploaded files.
- Use of single function to manually upload any web-server file from web-server to an S3 bucket.
- Option to feed Bucket name, Region, File ACL and many more dynamically
- Use of the original AWS SDK library to connect with the S3 service.
- Copy a S3 file in same Bucket.
- Create a S3 Bucket in AWS account.
See how easy it is to use, with sample codes.
Using do_upload_s3() function, the uploaded file will store on same relative location in an S3 Bucket instead of web-server.
//Normal code to upload a file on web-server $this->upload->do_upload(); //Change to $this->upload->do_upload_s3();
Using s3_site_url() function, File will be referenced from same relative location from S3 Bucket instead of web-server.
//Normal code to refer a file on web-server <a href="<?php echo site_url("uploads/myphoto.jpg");?>">Download</a> //Change to <a href="<?php echo s3_site_url("uploads/myphoto.jpg");?>">Download</a>
Upload a file manually from the web-server to an S3 bucket
//Upload myphoto.jpg file to S3 Bucket. $this->upload->do_upload_manually('user_photos/','myphoto.jpg','user_photos/');
Copy a S3 file from one Bucket to another or in same Bucket
//Copy S3 File $this->cis3integration_lib->copy_s3_file("myfile.jpg","copy_of_myfile.jpg");To create a S3 Bucket in your AWS account
//Create a S3 Bucket $bucket_name = "cis3demotestingbucket"; $flag = $this->cis3integration_lib->create_bucket($bucket_name);
Find here the detail documentation: Documentation
We are willing to help and provide support you through any problems you may have, or and features/suggestions that you want to implement. Just send me an email or leave a comment.
26 March, 2016: What’s new
# Codeigniter 3.x demo included, Now use the latest version of Codeigniter.
# Latest AWS SDK for PHP Version 3 implemented
# Set Bucket name dynamically
# Option to specify Region name
# Option to choose File ACL
# Option to rename or not the file during upload
13 Nov, 2013: What’s new
# Delete a File from S3 Bucket.
# Copy a File from one Bucket to another or in same Bucket.
# Create a S3 Bucket in AWS account.
# File can be upload on root of S3 Bucket without any folder.
# Maintaied upload file mime type so Images do not get download when viewing on AWS URL.
# Better quality and maintained code, did changes in structure slightly for improvement. It will be easy to understand.
Note: AWS/S3 and Codeigniter are the Trademarks of their respective owners.
25 June 13
27 March 16