[eluser]CappY[/eluser]
The controller:
Code:
$config['upload_path'] = '/var/www/npsig/htdocs/backgrounds/';
$config['allowed_types'] = 'jpg|jpeg|png';
$config['overwrite'] = FALSE;
$config['max_size'] = '256';
$config['max_width'] = '250';
$config['max_height'] = '250';
//$config['file_name'] = 'image'.$data['backgrounds']->row()->id.'.png';
$this->load->library('upload', $config);
if (!$this->upload->do_upload())
{
$data['msg'] = $this->upload->display_errors();
}
else
{
$data['msg'] = $this->upload->data();
}
That's view:
Code:
<?=$msg?>
<?php echo form_open_multipart('submit/background');?>
<input type="file" name="userfile" size="50" />
<br /><br />
<input type="submit" name="submit" value="Submit background" />
</form>
I always get:
Code:
The upload path does not appear to be valid.
I tried changing to:
Code:
$config['upload_path'] = './backgrounds/';
$config['upload_path'] = '/backgrounds/';
$config['upload_path'] = 'backgrounds/';
$config['upload_path'] = './backgrounds';
$config['upload_path'] = '/backgrounds';
$config['upload_path'] = 'backgrounds';
CI architecture is that way:
root
root/application <- controllers,models,views.
root/system
root/htdocs
root/htdocs/backgrounds <- upload dir