php - Codeigniter drag and drop -
i new codeigniter.can please tell me how include drag , drop feature upload multiple images in codeigniter complete description of mvc architecture , code. here 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 want save in db,where here // out model 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 */ , here 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 , codeigniter - arjun.net.in</h1> <form action="<?php echo site_url('/dropzone/upload'); ?>" class="dropzone" > </form> </body> </html> , have uploads folder , resources folder contains copy of dropzone-4.0.1 zip file. while running localhost/drag/index.php/dropzone , drag project name, showing ; file upload using dropzone.js , codeigniter - arjun.net.in
you can implement via js codeigniter. see https://github.com/danielm/uploader
Comments
Post a Comment