[eluser]jshultz[/eluser]
Ok, I've cleaned up the code to the point that I'm basically copying the user guide. Here's what I have:
Here's the Upload Function:
Code:
function do_upload() {
$this->load->helper(array('form', 'url'));
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '2000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$this->upload->do_upload();
if ( ! $this->upload->do_upload())
{
$this->load->model('Gallery_model');
$error = array('error' => $this->upload->display_errors());
echo var_dump($error);
$upload_info = $this->upload->data();
echo var_dump($upload_info);
$data['gallery_path'] = $this->gallery_path;
$data['gallery_path_url'] = $this->gallery_path_url;
$data['images'] = $this->Gallery_model->get_images();
$data['page_title'] = 'Verde Valley Business Resource - Gallery Manager';
$data['page'] = '/ads/gallery_view'; // pass the actual view to use as a parameter
$this->load->view('container',$data);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
Here's the view:
Code:
<div class="span-24">
<div class="span-6"><?php include('about-include.php'); ?></div>
<div class="span-16 prepend-1">
<h2>Welcome to the Ad Manager!</h2>
<?php
echo $gallery_path; echo '<br/>';
echo $gallery_path_url;
?>
<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('/gallery/do_upload');
echo form_hidden('redirect', '/gallery/index');
echo form_upload('userfile');
echo form_submit('upload', 'Upload');
echo form_close();
?>
</div>
</div>
</div>
I'm not even messing with a model.
When I upload a file, it's still not going into the folder. I've tried different ways for formatting the path. I've made sure that the folder is 777. Here's the errors that I'm getting back:
array(1) { ["error"]=> string(102) "
The upload path does not appear to be valid.
The upload path does not appear to be valid.
" } array(13) { ["file_name"]=> string(0) "" ["file_type"]=> string(0) "" ["file_path"]=> string(0) "" ["full_path"]=> string(0) "" ["raw_name"]=> string(0) "" ["orig_name"]=> string(0) "" ["file_ext"]=> string(0) "" ["file_size"]=> string(0) "" ["is_image"]=> bool(false) ["image_width"]=> string(0) "" ["image_height"]=> string(0) "" ["image_type"]=> string(0) "" ["image_size_str"]=> string(0) "" }
Any ideas?