File Upload using dropzone.js and Codeigniter

In this post, I will show you, how to upload files with drag and drop interface with dropzone.js in your Codeigniter framework applications.

Dropzone.js comes with nice CSS and Javascript that makes it a breeze to work with HTML 5 file upload API. It provides you with a file input container that users can drag and drop files unto or just click the container to select multiple files from the file system.

Supported Browsers?

Based on the plugin documentation Dropzone.js works in :

      Chrome 7+
      Firefox 4+
      IE 10+
      Opera 12+ (Currently disabled for MacOS because their API is buggy)
      Safari 5+

For all the other browsers, dropzone provides an old-school file input fallback.

How to implement in Codeigniter

1.First Download CodeIgniter, and setup locally. Then create a folder in application root folder(where index.php lives) for storing uploaded Files.

2. Download dropzone.js from https://github.com/enyo/dropzone, extract the zip copy all files from download folder, and place it in your resources folder(create folder just like uploads).

3. create a controller File called dropzone.php in controller dir then place the fallowing code.

4 Create a view File Called dropzone_view.php in views.Feed with bellow code

I hope this tutorial helps you please don’t forget to give us your feedback in comments.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.