File Upload with Progress Bar using CodeIgniter and Ajax

File uploading is a common feature of dynamic web applications. Learn here to file upload using Ajax without page refresh. In this tutorial, we will learn how to File Upload with Progress Bar using CodeIgniter, jQuery, and Ajax. This is a very simple example, you can just copy-paste, and change it according to your requirements.
Before started to implement the File Upload with Progress Bar using CodeIgniter, look files structure:
  • file-upload-with-progress-bar-using-codeigniter-jquery-ajax
    • application
      • config
        • autoload.php
        • constants.php
        • routes.php
      • controllers
        • Upload.php
      • views
        • upload
          • index.php
        • templates
          • header.php
          • footer.php
    • system
    • index.php
    • assets
      • css
        • style.css
      • uploads
Step 1: Create an HTML form
a- File Upload Form
b- HTML element to display the progress bar
c- HTML element to display the file uploaded status
Step 2: Include the jQuery library
The jQuery and Ajax is used to upload file with a progress bar, so include the jQuery library.
Ajax Code Uploding file with reloding page
Step 3: Create a view
Create a view file named index.php inside “application/views/upload” folder.
Step 4: Create a controller file
Create a controller file named Upload.php inside “application/controllers” folder.
Step 5:Create a view(header)
Create a view file named header.php inside “application/views/templates” folder.
This view contains the header section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header section.
Step 6: Create a view(footer)
Create a view file named footer.php inside “application/views/templates” folder.
This view contains the footer section of the webpage.