gpt4 book ai didi

php - CodeIgniter:图片未上传。

转载 作者:行者123 更新时间:2023-12-05 05:26:56 28 4
gpt4 key购买 nike

gallery.php - 查看

 <!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>CI Gallery</title>
</head>
<body>


<div id="upload">
<?php
$this->load->helper("form");
echo form_open_multipart('gallery/up');
?>
<input type="file" name="file">
<?php
echo form_submit('upload','Upload');
echo form_close();
?>
</div>
</body>
</html>

gallery.php- Controller

<?php
class Gallery extends CI_Controller {

function index()
{
$this->load->view('gallery');

}

function up()
{
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '1000000';
$config['max_width'] = '10240';
$config['max_height'] = '7680';
$this->load->library('upload',$config);
$this->upload->do_upload('file');
$this->load->view('gallery');
}


}

这些是我的编码文件。这里没有上传文件。有人请帮忙。我觉得库上传无法加载,因此停止工作。如果那是问题,如何解决。

最佳答案

在你的html中添加表单标签

<form enctype="multipart/form-data" name="" action=""></form>

关于php - CodeIgniter:图片未上传。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23106515/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com