[eluser]The Casual Bot[/eluser]
Hey everyone
iv had a look round Google and the Ci forum but cant find the help i need
my uploads currently workd for .bmp .jpeg .jpg & .png (the default ones in the user guide)
but when i added pdf|doc|xls|xlsx|tiff|docx
i can upload any of these files but the original ones still work
heres a section my controller
Code:
function do_upload()
{
print_r($_FILES);
$map = directory_map('./files/');
if (!isset($map[$this->uri->segment(3)])) {
$this->ftp->connect();
$this->ftp->mkdir('/public_html/files/'.$this->uri->segment(3), DIR_WRITE_MODE);
}
$config['upload_path'] = './files/'.$this->uri->segment(3);
$config['allowed_types'] = 'docx|gif|jpg|png|pdf|doc|xls|xlsx|tiff|jpeg';
$config['max_size'] = '2048';
$config['max_width'] = '0';
$config['max_height'] = '0';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$this->load->model('Viewappmodel');
$data['data'] = $this->Viewappmodel->full($this->uri->segment(3));
$data['data']['message'] = $this->upload->display_errors('<p class="msg error">', '</p>');
$this->load->view('header_view');
$this->load->view('sidebar_view');
$this->load->view('viewapp', $data);
$this->load->view('footer_view');
}
else
{
$this->load->model('Viewappmodel');
$data['data'] = $this->Viewappmodel->full($this->uri->segment(3));
$file = $this->upload->data();
$data['data']['message'] = '<p class="msg done">File Uploaded ( '.$file['file_name'].' )</p>';
$this->load->view('header_view');
$this->load->view('sidebar_view');
$this->load->view('viewapp', $data);
$this->load->view('footer_view');
}
}
from some advice i got from the forum im printing out $_FILES and it contains the following
Code:
Array ( [userfile] => Array ( [name] => 123456789.pdf [type] => application/pdf [tmp_name] => /tmp/phpMXeoUT [error] => 0 [size] => 340655 ) )
the error returned by the upload class is
Code:
The filetype you are attempting to upload is not allowed.
and my form is
Code:
<?php echo form_open_multipart('viewapp/do_upload/'.$data['application_id']);?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="upload" />
</form>
thanks in advance for you help