dtzh131555 2015-06-19 11:13
浏览 24

Codeigniter拖放

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
  • 写回答

1条回答 默认 最新

  • dongyan8929 2015-06-19 11:31
    关注

    You can implement via JS into codeigniter. see this https://github.com/danielm/uploader

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b