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!
Features:
- 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.
- Create Pre-signed url for sharing temp download link for any file in S3 bucket
- Allow direct browser upload, without uploading to server first. A efficient approach for big size files.
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);
To create a pre-signed url of a file in S3 bucket
//Create a pre-signed url $presignedUrl = $this->cis3integration_lib->get_presigned_url("myfile.jpg",10); //where 10 is the lifetime of pre-signed url in seconds
To do direct upload to s3 from browser
<!-- Start of the JavaScript --> <!-- Load jQuery & jQuery UI (Needed for the FileUpload Plugin) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.7/jquery.fileupload.js"></script> <!--Load Javascript library--> <script src="<?php echo site_url("js/cis3integration_lib.js");?>"></script> <script> var config = { // Place any uploads within the descending folders // so ['test1', 'test2'] would become /test1/test2/filename //var folders = ['uploads']; upload_path:['uploads'], allowed_types: ['jpeg', 'jpg', 'png', 'gif', 'bmp', 'pdf', 'doc', 'docs', 'zip'], max_size:5120, make_unique_filename:true, s3_key_field:"key", progress_loader_div:"progress-bar-area", uploaded_files_field_id:"uploaded" }; ciS3Integration.setConfig(config); ciS3Integration.s3Upload("direct-upload"); function callFileValidation(fileField){ return ciS3Integration.doFileValidation(fileField); } </script> //Refer the source code for more detail.
Documentation:
Find here the detail documentation: Documentation
Free Support:
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.
Updates
19 Nov, 2017: What’s new
# Create Pre-signed URL for temp download link.
# Browser Upload: Upload a file directly from browser to S3 bucket without uploading to server first. An efficient approachh for big size files.
# Create a S3 Bucket in AWS account.
# Added bootstrap support in demo
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.
[eltd_button size=”huge-full-width” type=”outline” text=”Download & Demo Links” custom_class=”#” icon_pack=”font_awesome” fa_icon=”” link=”” target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Demo = CodeIgniter AWS S3 Integration Library
[eltd_button size=”huge” type=”” text=”Full Live Demo” custom_class=”” icon_pack=”font_awesome” fa_icon=”fa-laptop” link=”https://codecanyon.net/item/codeigniter-aws-s3-integration-library/4993914″ target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Kindly Note: We update new contents like WordPress Themes, Plugins, PHP Scripts everyday. But remember that you should never use this items in a commercial website. All the contents posted here for development & testing purpose only. We’re not responsible for any damage, use at your own RISK! We highly recommend to buy CodeIgniter AWS S3 Integration Library from the The Developer ( scriptigniter ) website. Thank you.
Download = CodeIgniter AWS S3 Integration Library-[Updated].zip