使用CodeIgniter 3并遇到“id_case”问题。它说undefined索引:id_case。
当我点击的index.php
<?php echo "<td><a href='/ci_dropzone/?id_case=".$row['id_case']."'>Upload File To This ID</a></td>";?>
一个链接,然后我在文件中使用笨3 +悬浮窗-4.1, 说upload.php的控制器中的文件夹有:
<?php require 'conn.php'; <== i add this linker
if (!defined('BASEPATH'))exit('No direct script access allowed');
class Gambar extends CI_Controller {
private $datauser;
function __construct() {
parent::__construct();
$this->load->helper(array('url','file'));
}
function index(){
$data['js'] = base_url('assets/js');
$data['css'] = base_url('assets/css');
$data['img'] = base_url('assets/images');
$this->load->view('gambar', $data);
}
function gambar_upload() {
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$fileName = $_FILES['file']['name'];
$fileType = $_FILES['file']['type'];
$fileSize = $_FILES['file']['size'];
$filelink = $_GET['id_case']; <== i add this line
$targetPath = './assets/uploads/';
$targetFile = $targetPath . $fileName ;
move_uploaded_file($tempFile, $targetFile);
$this->db->insert('uploadtable', array('idlink' => $filelink, 'nama' => $fileName, 'tipe' => $fileType, 'ukuran' => $fileSize));
}
}
}?>
我努力尝试如何使用功能$ _GET得到id_case数字以便iam能够自动使用id_case号码,无需标记<form>
并提交订单即可插入数据库上传表idlink表列。像这样显示的错误:
遇到甲PHP错误
严重性:注意
消息:未定义指数:id_case
文件名:控制器/ upload.php的
线编号:32
Backtrace:
文件:E:\ controlX \ htdocs中\ CI-悬浮窗\应用\控制器\ upload.php的 行:32 功能:_error_handler
文件:E:\ controlX \ htdocs中\ CI-悬浮窗\索引。 PHP 线:294 功能:require_once 数据库出错
错误编号:1048
列 'idlink' 不能为空
INSERT INTO
uploadtable
(idlink
,nama
,tipe
,ukuran
)VALUES(NULL, '10000000000257660_1920x1080.jpg', '图像/ JPEG',1257381)文件名:E:/ controlX/htdocs中/ CI-悬浮窗/应用/控制器/上传.PHP
行号:38
如何解决这个问题?
你可以在添加后显示完整的代码吗? – dwic