dongyi1159 2015-11-04 09:51
浏览 59
已采纳

您没有选择要上传的文件。但是图片已上传

I found so many questions with this same error . But those answers did not clear my error and still the error remains

when i try to upload image . this error comes

" You Did not select a file to upload "

But the image is uploaded in the correct location ..

Controller

class image extends CI_Controller {

  function __construct() {
    parent::__construct();

    $this->load->helper(array('form', 'url'));

    $this->load->library('session');

    $this->load->library('layout');

    $this->load->model('admin_m');

    $this->load->library('upload');

  }

  function projects_more() {

    $config['upload_path'] = './uploads/';

    $config['allowed_types'] = 'gif|jpg|png';

    $config['max_size'] = '100000';

    $config['max_width'] = '102400';

    $config['max_height'] = '76800';


    $this->load->library('upload', $config);

    $this->upload->initialize($config);

    if (!$this->upload->do_upload('photo')) {

        $error = array('error' => $this->upload->display_errors());

        $this->layout->view('home_page', $error);

    } else {

        $data   = array('upload_data' => $this->upload->data());
        $data1  = $this->upload->data();
        $image  = $data1['file_name'];
        $project  = $this->input->post('project');


        $content= $this->input->post('content');

        $this->admin_m->projects_more($image,$project,$content);
        redirect('image/projects_more');

    }
  }
}

My view page

projects1.php

<?php echo form_open_multipart('image/projects_more'); ?>

<table>

<tr>

<td><input type="file" name="photo" id="photo" size="20"></td>

</tr>

</table>

<input type="submit" name="submit" value="Submit">

<?php echo form_close(); ?>
  • 写回答

2条回答 默认 最新

  • drl959975 2015-11-06 05:54
    关注

    Sorry . it was my mistake. the function projects_more uploads the image first time and at the end of the function i redirected to same function where there is no file to upload . first time it uploads the image and second time it doesn't..sorry for wasting your time. thanks Deniz B.

    now i redirected to index function that shows the view page to select the next image and its details ..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP