[eluser]Unknown[/eluser]
Hi there, as the title suggests, I'm having some issue with the file upload
Code:
// MAIN EVENT BANNER
// will ONLY upload a file or change anything if there's been a file submitted
if(!empty($_FILES['banner']['name']))
{
$config['upload_path'] = './uploads/banners/';
$config['allowed_types'] = 'png'; // only PNG file types are allowed
$config['max_size'] = '10240';
$config['max_width'] = '958';
$config['max_height'] = '298';
$config['remove_spaces'] = 'true';
$config['overwrite'] = 'true';
$this->load->library('upload', $config);
if($this->upload->do_upload('banner'))
{
$data['upload_data'] = $this->upload->data();
$event['banner'] = 'uploads/event/banners/' . $data['upload_data']['file_name'];
}
else
{
// if the upload fails, do NOT change the banner
if(is_dir($config['upload_path']))
{
echo 'yes, directory exists';
}
else
{
echo 'no, directory does not exist';
}
echo '<br />';
if(is_writable($config['upload_path']))
{
echo 'yes, directory writable';
}
else
{
echo 'no, directory not writable';
}
$error = array('error' => $this->upload->display_errors());
}
}
else
{
$event['banner'] = 'placeholder.jpg';
}
My code returns that the directory IS writable, and it DOES exist. But I keep getting caught with an error message telling me the file upload path is invalid.
I have the same code elsewhere (for blog posts) and it works perfectly. So, I'm somewhat confused?