-2

这是我的代码:

if (count($template) >=1) { ?>  

    <div class="mdl-cell mdl-cell--4-col" id="select">
        <div class="mdl-card mdl-shadow--4dp">
            <div class="mdl-card__title">
                <h2 class="mdl-card__title-text">select <?php echo $module[$i]->im_name; ?> Template</h2>
              </div>
            <div class="mdl-card__media">
                <?php echo $template[0]->iut_tempname; ?>

            </div>

            <a href="<?php echo base_url("Account/template_list/"); ?>" class="btn btn-info btn-lg">
                    <span class="glyphicon glyphicon-cog"></span>
            </a>

        </div>
    </div>  

    <?php

        }

我想传递这个 im_name 的 o/p;?> 到控制器。

4

1 回答 1

1

希望对你有帮助 :

uploads在您的视图文件夹中创建一个文件夹并VIEWPATH用于upload_path这样的:

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

你的代码应该是这样的:

if (isset($_FILES["image_file"]["name"])) 
{

    $config['upload_path']  = VIEWPATH.'uploads/'; 
    $config['allowed_types']= 'txt|php|html';

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

    if (!$this->upload->do_upload('image_file')) 
    {
        echo $this->upload->display_errors();
    }
    else
    {
        $data = $this->upload->data();
        echo '<img src="'.base_url().'uploads/'.$data["file_name"].'" />';  
    }
}

更多信息:https ://www.codeigniter.com/user_guide/general/reserved_names.html

于 2018-07-09T12:55:10.750 回答