Skip to content

File Upload using Uplodify in Codeigniter?

Last updated on February 1, 2018

In this Codeigniter tutorial, I will show you how to use Uplodify(HTML5 or Flash Multiple File Upload jQuery Plugin Script) in your CodeIgniter application.

If you are new to uploadify feel free to read about Uploadify

Some features of Uploadify

  • Multiple File Uploads
  • Drag and Drop
  • Real-Time Progress Indicators
  • Custom Upload Restrictions
  • Extreme Customization

How to implement Uplodify in Codeigniter

Create a Controller called : Upload.php in your application/controller. uploadify() method will upload the files to the server and return upload object on success ,return error object on failure.

load->helper(array('url', 'form'));
	}

	public function index()
	{
		$this->load->view('upload_form');
	}

	public function uploadify()
	{
		$config['upload_path'] = "./uploads";
		$config['allowed_types'] = '*';
		$config['max_size'] = 0;
		$this->load->library('upload', $config);

		if (!$this->upload->do_upload("userfile"))
		{
			$response = $this->upload->display_errors();
		}
		else
		{
			$response = $this->upload->data();
		}
		$this->output->set_content_type('application/json')->set_output(json_encode($response));
	}
}

/* End of file uploadify.php */
/* Location: ./application/controllers/uploadify.php */

Now create your View file called upload_form.php in your application/views/ directory.In our view we will have standard Uploadify stuff.




  
  
  
  
  



    

If you still can’t get it, just leave a comment, and we will try to help.
Thank you!

0 0 votes
Article Rating
Subscribe
Notify of
guest

22 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments