Welcome Guest, Not a member yet? Register   Sign In
Upload File Problem
#7

[eluser]LuckyFella73[/eluser]
I didn't test this but you could try
Code:
// in the validation part of your code:

// this one doesn't make sense
// the rules or only for form elements which are in the $_POST array
// your file is send in the $_FILE array
$this->form_validation->set_rules('filename', 'File', 'trim');// comment out this line



// later on this part should look like:

// ... other code here

if (!$this->upload->do_upload('filename'))
{
    echo $this->upload->display_errors();
}
else
{
    // $this->upload->do_upload(); // you don't need that one
    
    $data = $this->upload->data();
    
    $filename = $data['file_name'];
    
    $filestable= array(
        'userid' => $userid['userid'],
        'filename' => $filename,
        'fileowner' => $userfullname,
        'fileyear' => $fileyear,
        'filemonth'=>$filemonth,
        'fileday'=>$fileday
    );
    
    $this->Model_files->upload_files($filestable);
    redirect('files/upload');
}

Hope that helps


Messages In This Thread
Upload File Problem - by El Forum - 04-15-2011, 09:58 AM
Upload File Problem - by El Forum - 04-15-2011, 11:15 AM
Upload File Problem - by El Forum - 04-15-2011, 11:25 AM
Upload File Problem - by El Forum - 04-15-2011, 11:50 AM
Upload File Problem - by El Forum - 04-15-2011, 11:58 AM
Upload File Problem - by El Forum - 04-15-2011, 12:07 PM
Upload File Problem - by El Forum - 04-15-2011, 04:32 PM
Upload File Problem - by El Forum - 04-16-2011, 12:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB