I am new to codeigniter.Can anyone please tell me how to include drag and drop feature to upload multiple images in Codeigniter with complete description of MVC Architecture and code. Here is my controller dropzone.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Dropzone extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper(array('url','html','form'));
}
public function index() {
$this->load->view('dropzone_view');
}
public function upload() {
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$fileName = $_FILES['file']['name'];
$targetPath = getcwd() . '/uploads/';
$targetFile = $targetPath . $fileName ;
move_uploaded_file($tempFile, $targetFile);
// if you want to save in db,where here
// with out model just for example
// $this->load->database(); // load database
// $this->db->insert('file_table',array('file_name' => $fileName));
}
}
}
/* End of file dropzone.js */
/* Location: ./application/controllers/dropzone.php */
and here is my views:
<html>
<head>
<link href="<?php echo base_url(); ?>resouces/css/dropzone.css" type="text/css" rel="stylesheet" />
<script src="<?php echo base_url(); ?>resouces/dropzone.min.js"></script>
</head>
<body>
<h1>File Upload using dropzone.js and Codeigniter - arjun.net.in</h1>
<form action="<?php echo site_url('/dropzone/upload'); ?>" class="dropzone" >
</form>
</body>
</html>
and I also have uploads folder and resources folder that contains copy of all dropzone-4.0.1 zip file.
But while running localhost/drag/index.php/dropzone , drag is the project name, it is showing ;
File Upload using dropzone.js and Codeigniter - arjun.net.in