Codeigniter file upload not working

前端 未结 2 687
Happy的楠姐
Happy的楠姐 2021-01-18 19:42

I write code for upload a image file. But it always show You did not select a file to upload. This is my code.

view



        
相关标签:
2条回答
  • 2021-01-18 19:42

    At your PHP change

    $this->upload->do_upload()
    

    to

    $this->upload->do_upload("add_1")
    

    where "add_1" is your input name attribute.

    Codeigniter UPLOAD library docs

    P.S. At your HTML the Label attribute for="" is targeting input ID so you have to add id to your input.

    0 讨论(0)
  • 2021-01-18 20:05

    i recenly got that problem and solve it. you can check is module fileinfo in php already on? if you can access to CPanel, you can go to SOFTWARE TAB then search Select PHP Version, then you can see list of module and check that module fileinfo. and try to upload again.

    0 讨论(0)
提交回复
热议问题