相关疑难解决方法(0)

在Codeigniter中上传多个文件

我想使用单个元素上传多个文件.所以我试试这个例子.

使用CodeIgniter 2.0上传多个文件(Array)

这是我的表格

<form enctype="multipart/form-data" class="jNice" accept-charset="utf-8" method="post" action="http://xxxx.dev/admin/add_estates">              
    <fieldset>      
            <label>Title * : </label>                       
            <input type="text" class="text-long" value="" name="title">

            <label>Description : </label>                       
            <textarea class="mceEditor" rows="10" cols="40" name="description"></textarea>

            <label>Image : </label>                     
            <input type="file" multiple="" name="images[]">                             

            <button class="button-submit" type="submit" name="save" id="">Save</button>
    </fieldset>         
</form>
Run Code Online (Sandbox Code Playgroud)

这是我的控制器

public function add_estates()
{
    $data['page_title'] = "&copy; IDEAL - Administrator - Real State - Add Real Estate";
    $data['main_content'] = 'admin/add_estates';

    if ($this->input->post() !== FALSE) {           
        $this->load->library('form_validation');
        $this->form_validation->set_rules('title', 'Career Title', 'trim|required');           

        if ($this->form_validation->run() !== FALSE) {                

            $title = …
Run Code Online (Sandbox Code Playgroud)

php upload codeigniter file-upload

14
推荐指数
1
解决办法
9万
查看次数

在Codeigniter中上载图像显示错误上载路径似乎无效

$config['upload_path'] = site_path().'photos/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '2048';
$this->load->library('upload', $config);    
if ( ! $this->upload->do_upload())
{ 
    $this->data['alert'] = $this->upload->display_errors();                     
    $this->load->view('profile/photo', $this->data);
}   
else
{
    $upload_data = $this->upload->data();

    $filename = $upload_data['file_name'];
    $width = $upload_data['image_width'];
    $height = $upload_data['image_height'];
    $config1 = array();
    $this->load->library('image_lib');
    $config1['source_image'] = site_path().'photos/'.$filename;


    $this->remove_existing_file($this->session->userdata('user_id'));
    $this->Profile_model->savephoto('Edit', $filename );
    redirect('/profile/photo');
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

上传路径似乎无效.

codeigniter

3
推荐指数
1
解决办法
3万
查看次数

标签 统计

codeigniter ×2

file-upload ×1

php ×1

upload ×1