开发者

upload file codeigniter

开发者 https://www.devze.com 2023-03-24 22:20 出处:网络
hi i am trying to upload a file in codeigniter but some how the file is not being uploaded. Here is the code,

hi i am trying to upload a file in codeigniter but some how the file is not being uploaded. Here is the code,

$config = array(

                   'file_name'     => 'user',
                   'max_size'      => 100,
                   'upload_path'   => realpath(APPPATH.'../files/'),
                                );




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

                $this->upload->do_upload();


                $upload_data = $this->upload->data();

this is actually the code of a method in a model which i am calling through a controller method which in turn is a method i cll on form submit.

the file reaches t开发者_JS百科he method it shows uploading in the browser but when i see file name key of $upload_data it has user without extension and according to me there should be extension too right? . also when i try to print extension it shows nothing. BTW i am trying to upload small 3gp file approx 770kbs taken on my mobile. There is nothing in files folder too. Thank you for your help

Stilll nothing, please help.

Checked for permissions


My guess is that it's one of two issues:

1) You aren't including the list of valid extensions, as shown in the documentation (under The Controller)

For this, you need to add 'allowed_types' => '3gp' to your configuration.

2) Permissions issues on the upload path

You'll need to ensure that the files folder is writable, along with every folder above it for Apache.

See this StackExchange question for more on #2.

0

精彩评论

暂无评论...
验证码 换一张
取 消