Upload files with CodeIgniter and Plupload
Why choose Plupload?
- It's not based on flash.
- You can track progress.
- You can upload multiple files simultaneously.
- It supports chunking.
- It supports drag and drop.
- It's free and open source.
Download the library here.
Copy its contents to a folder in your site. Let's say js/libs/plupload.
And use this code in your CodeIgniter view:
Creating a simple file uploader
Creating the upload button
First of all, you 'll need an upload button.
This is a comma separated list of runtimes that you want to initialize the uploader instance with. It will try to initialize each runtime in order if one fails it will move on to the next one.
Maximum file size that the user can pick. This string can be in the following formats 100b, 10kb, 10mb.
Enables you to chunk the file into smaller pieces for example if your PHP backend has a max post size of 1MB you can chunk a 10MB file into 10 requests. To disable chunking, remove this config option from your setup.
Generate unique filenames when uploading. This will generate unqiue filenames for the files so that they don't for example collide with existing ones on the server.
URL to where the SWF file is for the Flash runtime.
URL to where the XAP file is for the Silverlight runtime.
Comma separated list of features that each runtime must have for it to initialize. Example:
The official site.