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.
精彩评论