Welcome Guest, Not a member yet? Register   Sign In
File uploading class bug or my bad ?
#1

[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 />

&lt;input type="submit" name="submit" value="Submit background" /&gt;

&lt;/form&gt;

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
#2

[eluser]Rok Biderman[/eluser]
Your bad, I would say

Code:
$config['upload_path'] = '../backgrounds/';
#3

[eluser]CappY[/eluser]
[quote author="Coccodrillo" date="1298752763"]Your bad, I would say

Code:
$config['upload_path'] = '../backgrounds/';
[/quote]

Code:
The upload path does not appear to be valid.

@Coccodrillo note that also tried absolute path:

Code:
/var/www/npsig/htdocs/backgrounds/
#4

[eluser]Rok Biderman[/eluser]
Absolute path is messed up for me. The string gets made based upon base_url() i should think, so it doesn't hurt to check settings there. I didn't just make up the config line i wrote, it actually works on my server. So it doesn't help and it's not permission based problem (which the error message would probably describe as such anyway), i'm afraid i'm all out of answers.
#5

[eluser]CappY[/eluser]
I already think it's bug!

after adding
Code:
$this->upload->initialize($config);

Code:
$config['upload_path'] = './backgrounds/';

Works just fine.

Without
Code:
$this->upload->initialize($config);
just
Code:
$this->load->library('upload', $config);
same path will not work for me.




Theme © iAndrew 2016 - Forum software by © MyBB