Saturday, December 1, 2018

How to Upload Image and File in Codeigniter 

File uploads are an essential process in many web apps. Besides having Best PHP Hosting, almost every website and web app requires an integrated file upload component. File and image upload in CodeIgniter powered app is a simple component that takes care of the upload process with little issues.
This tutorial discusses the process of creating a CodeIgniter based file upload component that could be easily used t upload images and other files with ease. You could validate and even restrict file size and type during the upload process.


Folder Creation:

The first step is the creation of two folders that form the basis of the upload process. The first folder is the destination folder that would receive the uploaded files.Next, go to the root of the CI installation and create a folder named “upload”.

Create the Controller:

The next step is the creation of a file in the controller folder.  Name the file service.php. In this file, I will load a library for initializing the Upload class through the following code.

Create the Model:

The next step is the creation of a file in the models folder.  Name the file Smodel.php



No comments:

Post a Comment