Welcome Guest, Not a member yet? Register   Sign In
File Upload Hell

I've been learning CodeIgniter and applying it to our online store (northbreeze.com). It's been fantastic so far, and I'm currently generating a "Latest Additions" newsletter for subscribers.
I'd like to provide registered users with the ability to create their own pages with their own images. Everything is working except the file upload. No matter what I do I keep getting
"The upload path does not appear to be valid."
The paths I've tried are valid. The permissions are all set to 777.
Finally tried to upload using the scripts supplied in the User Guide and they don't work either. Same message. I don't see why an operation this basic should be so problematic. I've written file upload scripts in plain PHP and I suppose I can hook one of those up somehow, but it would be much better if I didn't have to.
FYI here are the scripts from the User Guide:

upload.php (only change has been to "$config['upload_path'] = './uploads/';"):

class Upload extends Controller {

function Upload()
$this->load->helper(array('form', 'url'));

function index()
$this->load->view('upload_form', array('error' => ' ' ));

function do_upload()
$config['upload_path'] = './uploads/'; // Only changes here
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload_form', $error);
$data = array('upload_data' => $this->upload->data());

$this->load->view('upload_success', $data);

upload_form.php (no changes):
<title>Upload Form</title>

<?php echo $error;?>

<?php echo form_open_multipart('upload/do_upload');?>

<input type="file" name="userfile" size="20" />

<br /><br />

&lt;input type="submit" value="upload" /&gt;



upload_success.php (no changes):
&lt;title&gt;Upload Form&lt;/title&gt;

<h3>Your file was successfully uploaded!</h3>

&lt;?php foreach($upload_data as $item => $value):?&gt;
<li>&lt;?php echo $item;?&gt;: &lt;?php echo $value;?&gt;</li>
&lt;?php endforeach; ?&gt;

<p>&lt;?php echo anchor('upload', 'Upload Another File!'); ?&gt;</p>


Any help would be greatly appreciated, and thanks in advance

Peter Weicker
[email protected]
[email protected]

did you try using an explicit path like /home/myaccount/uploaddir ?

yes i did, thanks. all kinds of them. also adapted a plain php script. that actually works, but i would prefer not having to step in and out of CI to get work done. one of the things i had enjoyed about using CI was a measure of relief from the oppressive fussiness of php.

.. how about with no trailing slash..?

check the log for errors.

Have you tried using an absolute path with a trailing slash at the end?.


Theme © iAndrew 2016 - Forum software by © MyBB