Welcome Guest, Not a member yet? Register   Sign In
files not getting uploaded
#1

[eluser]stef25[/eluser]
this has had me stumped for the past 2 days. i have two forms: one creates a new entry in the db, the other edits an existing one. they have the same fields and use the same _do_upload callback to handle the image upload.

when creating a new item, the code below prints out the full path, in this case: /Applications/MAMP/htdocs/my-site/images/_uploads/aaaa_400.jpg

Code:
$this->_data = $this->upload->data();                
$config['source_image'] = $this->_data['full_path'];
print_r($config['source_image']);

when i edit an existing item i just get /Applications/MAMP/htdocs/my-site/images/_uploads/

obviously its not receiving the image since the filename is missing.

ive checked

- both forms have enctype="multipart/form-data"
- both forms have the same name for the file upload field

for the edit form the callback is called as below

Code:
if($_FILES['prod_img']['error'] !== 4) {
                print_r($_FILES);
                $this->form_validation->set_rules('prod_img', 'product image', 'callback__do_upload');    
            }

the $_FILES array in the snippet above does print out all the right data, including the filename. so the data is there, but it doesnt get passed to the callback function. anyone know why this would occur?

Code:
Array
(
    [prod_img] => Array
        (
            [name] => aaaa_400.jpg
            [type] => image/jpeg
            [tmp_name] => /Applications/MAMP/tmp/php/phpzDCl0z
            [error] => 0
            [size] => 125528
        )

)




Theme © iAndrew 2016 - Forum software by © MyBB