CodeIgniter Forums
uploading - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: uploading (/thread-36170.html)

uploading - El Forum - 11-23-2010

i have tried the upload example from the wesite

when i run the code and say upload i get the foll

the link is

and a 404 error.

Any help would be appreciated.

uploading - El Forum - 11-23-2010

Use Post Reply and code tags and show your code!


uploading - El Forum - 11-23-2010

If you're following the code in the user guide, your controller class should be Upload, and the method is do_upload. So, your form action value, i.e. the form open in your view should be

Are you putting the Upload controller in a subdirectory, i.e. application/controllers/search/upload.php ? If so, be sure your form_open_multipart() matches that path.

uploading - El Forum - 11-23-2010

Here is the controller


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/';
        $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);

the view

<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;



uploading - El Forum - 11-24-2010

i got it working...
now what if i want to show all the images as thumbnails or something...