Welcome Guest, Not a member yet? Register   Sign In
[Solved] Problems uploading 2 images on one form.

I have a form with two file inputs to upload images. My problem is uploading the second one. How do I upload two images and also retrieve the info for each upload separately (filename etc.)? All help is appreciated. At the moment only the first image is uploaded. The filepath for the first image is also shown where I expected the second file path to be.

In my controller:
$config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '10000';
        $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('addpageerror', $error);
$uploadimg = $this->upload->data('userfile');
                    $uploadthumb = $this->upload->data('thumbnail');
                    $date = date("Y-m-d");
                    $this->ptitle = $_POST['ptitle'];
                    $this->pabout = $_POST['pabout'];
                    $this->fullscr = $uploadimg['full_path'];/// First image path
                    $this->thumbnail = $uploadthumb['full_path']; /// Second Image Path
                    $this->url = $_POST['url'];
                    $this->date = $date;

$data = array('upload_data' => $this->upload->data());

<h2>Add New Work</h2>

&lt;?php echo  form_open_multipart('admin/portfolio/addwork'); ?&gt;
<h4>Project Title</h4>
&lt;input type="text" name="ptitle" value="" size="50" /&gt;
<h4>About Project</h4>
$data = array(
  'name'  => 'pabout',
  'id' => 'pabout',
  'value' => '',
  'rows' => '15',
  'cols'  => '80',
  'style' => 'width:100%',

echo form_textarea($data);

<h4>Services Used</h4>
        foreach($skillset->result() as $bow){
echo form_checkbox('skill[]', $bow->id, FALSE);
echo "$bow->value";

<h4>URL of Demo</h4>
&lt;input name="url" value="http://" type="text" /&gt;

<h4>Full Screenshot of Design</h4>
<p>Dimensions - 1024x768</p>
<p>&lt;input name="userfile" type="file" /&gt;&lt;/p>

<h4>Small Thumbshot of Design</h4>
<p>Dimension - 174x103 </p>
<p>&lt;input name="thumbnail" type="file" /&gt;&lt;/p>

<p>&lt;input type="submit" value="Submit" /&gt;&lt;/p>


Just noticed the image manipulation class. Codeigniter is awesome!

EDIT NEW PROBLEM: Displayed in original post

I encountered a new problem and instead of starting a new thread just changed the content in this one. Any help is greatly appreciated. I can't seem to work this one out :S

Theme © iAndrew 2016 - Forum software by © MyBB