首页 文章

上传文件移出代码点火器中的public_html文件夹

提问于
浏览
0

我的Web应用程序我需要在Code Igniter框架工作中从public_html上传文件 .

我的根结构是

home/user/
    .cpanel
    .gem
    .htpasswds
    .trash
    access-logs
    bin
    STORE_FILE
    etc
    mail
    php
    public_ftp
    public_html
    tmp
    www

如何通过使用php或代码点火器上传文件或从我的公共html文件夹移动到STORE_FILE位置 . 有什么功能可以让这项工作变得轻松吗?以及如何在主网站打电话?

2 回答

  • 0

    使用此控制器功能在此处定位您的表单

    function do_upload()
       {
        //set your configuration here
    
                //upload path which it contains write permission
        $config['upload_path'] = '/var/www/uploads/';
    
        $config['allowed_types'] = 'gif|jpg|png';       
    
        $this->load->library('upload', $config);
    
        if ( ! $this->upload->do_upload('form_field_name'))
        {
            $error = array('error' => $this->upload->display_errors());
    
            $this->load->view('upload_form', $error);
        }
        else
        {
            $data = array('upload_data' => $this->upload->data());
    
            $this->load->view('upload_success', $data);
        }
    }
    
  • 0

    只需更改上传的配置:

    $upload_config['upload_path'] = '/var/www/';      #when initializing the upload in CI
    

相关问题