codeigniter ajax Upload file – how to Upload file with ajax in codeigniter

codeigniter ajax Upload file – In this tutorial we provide information about Upload multiple files with ajax using codeigniter. in this tutorial we provide code to Upload multiple files using axaj without page redirection. this code is very easy to understand and execute.

Add/create this code in Upload.php. in this code we use ajax call for Upload multiple files. On submit of form, it will call function fileUpload() add we get all file information from

tag using “#file_upload_form” id( we use id of form tag) and pass data to ajax call to Upload.php controller. And most Impotent thing Do not miss mimeType : “multipart/form-data” in ajax call.

codeigniter ajax Upload file path

Path : codeigniter_folder/application/views/Upload.php

codeigniter ajax Upload file – Upload.php

Upload.php controller index.php is add upload library, helper and view Upload.php page And in function fileUpload () we Upload file in server folder and return success message.

Path : codeigniter_folder/application/Controllers/Upload.php

Upload.php controller

This code is very easy to use and execute in codeigniter. I hope it will help you.