I've almost taken this exactly as is from the CI docs, made some minor alterations to suit my needs but overall nothing significant. The folder I am attempting to upload to exists and has 777
set to its permissions.
The controller:
if($this->input->post('uploads'))
{
$config['upload_path'] = realpath(APPPATH.'../images');
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 0;
$config['max_width'] = 0;
$config['max_height'] = 0;
$config['remove_spaces'] = true;
$this->load->library('upload', $config);
if (!$this->upload->do_upload())
{
$data['errors'] = $this->upload->display_errors();
}
else
{
$data['upload_data'] = $this->upload->data();
}
}
The View:
<?php
if(isset($errors))
{
$this->genfunc->debugArray($errors);
}
if(isset($upload_data))
{
$this->genfunc->debugArray($upload_data, 'php');
}
?>
<div id="gallery">
<?php if (isset($images) && count($images)):
foreach($images as $image): ?>
<div class="thumb">
<a href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['thumb_url']; ?>" />
</a>
</div>
<?php endforeach; else: ?>
<div id="blank_gallery">Please Upload an Image</div>
<?php endif; ?>
</div>
<div id="upload">
<?php
echo form_open_multipart('upload');
echo form_upload('userfile');
echo form_submit('uploads', 'Upload');
echo form_close();
?>
</div>
The view is loaded as well, everything currently gets sent back to the same page, which is expected. But having taken from the CI example in the Docs, and going over everything I see no reason why this shouldnt be working. Hoping someone can shed some light on it, maybe I am missing something?