您没有选择要上传的文件. PHP代码点火器

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了您没有选择要上传的文件. PHP代码点火器脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试实现一个帖子功能,并希望从PHP视图中选择消息和图像.我的消息功能很好用.但在图像上传时收到错误您没有选择要上传文件.这是我的控制器功能
function post_func()
{
    session_start();
    echo $post_message=$_POST['post'];
    echo $share_wITh=$_POST['share_with'];
    echo $image=$_POST['image'];
    if($image==null){
        echo "<br/>no image<br/>";  
    }
    else{
        ////////////////////////////////////////////////////////////////////////////////////////

            $config['upload_path'] = './application/css';
            $config['Allowed_tyPEs'] = 'gif|jpg|png';
            $config['max_size'] = '100';
            $config['max_width']  = '1024';
            $config['max_height']  = '768';


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


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



            if ( ! $this->upload->do_upload())
            {
                $error = array('error' => $this->upload->display_errors());

                echo "<br/>";
                echo $this->upload->display_errors();
                echo "<br/> image error<br/>";
            }
            else
            {

                echo "<br/> reached <br/>";
                session_start();
                $this->;membership_model->insert_images($this->upload->data(),$email);
                $data = array('upload_data' => $this->upload->data());

                echo "<br/ PRoblem<br/>";
            }




        ////////////////////////////////////////////////////////////////////////////////////////
    }
    $public;
    if($share_with=="public"){
        echo "1";
        $public=true;
    }else{
        echo "0";
        $public=false;
    }echo "-----------------------------<br/>";
    echo $user=$this->session->userdata('user_identification');
    $data = array 
            (
                'userid'=> $user,'public' => $public,'message' => $post_message,'picname' => "None"
            );
    $this->load->model('membership_model');
    $this->membership_model->add_message($data);
    echo "</br>";
    echo $user=$this->session->userdata('user_identification');
}

这是我的观点.

<?PHP echo form_open('seArch/post_func');?>

<!--<form id="loginForm" action="../search/post_func" method="post" enctype="multipart/form-data" >-->
<div id="your_post">
<div id="post_image">
<img   id ="post_img" src="<?PHP  echo $this->config->item('base_url'); ?><?PHP echo '/application/css/'. $img ?>"/>
</div>
<textarea name="post" rows="5" cols="30" placeholder="Share an update..." id="post_text" rows="2" value=""></textarea>

//other view items
            <?PHP
    echo form_close();
    ?>

请帮我

更改:
<?PHP echo form_open_multipart('search/post_func');?>

脚本宝典总结

以上是脚本宝典为你收集整理的您没有选择要上传的文件. PHP代码点火器全部内容,希望文章能够帮你解决您没有选择要上传的文件. PHP代码点火器所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。