Codeigniter image upload not working

前端 未结 2 2018
隐瞒了意图╮
隐瞒了意图╮ 2021-01-24 13:27

I can\'t get my images to upload no matter what i do. Below is the code that is in my model:

function do_upload()
{
    $config[\'upload_path\'] = \'./uploads/\'         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-24 14:11

    Did something similar with a project - basically you just need to turn the path into a string and write it to your db...

    $fileup = $this->upload->data();
        $myfilepath = $fileup['file_name'];
        $databack = array(
            'your_field'=> 'http://www.yourserver.com/location/'.$myfilepath.'',
        ); 
        $DB->where('your_id_field', $id_value);
        $DB->update('your_table', $databack);  
    

    The trickiest bit is just tying it to your database!

提交回复
热议问题