EllisLab text mark
Advanced Search
     
Why can’t I get an image to upload?
Posted: 20 November 2012 06:37 PM   [ Ignore ]
Joined: 2012-11-04
22 posts

This was something I had working a few weeks back but after I made some changes to my view file images are now no longer being saved into my images folder. I keep getting back the error - The upload path does not appear to be valid. This is despite I have made sure the path is definitely correct. What am i doing wrong here?

Here is my view file:

<html>
<
head>
<
title>Upload Form</title>
</
head>
<
body>

<?php echo $error;?>
 <?
=form_open_multipart('homeprofile/upload');?>
        
<input type="file" name="userfile" />
        
<?=form_submit('submit''upload')?>
        <?
=form_close();?> 



</body>
</
html

My controller:

<?php
class HomeProfile extends CI_Controller 
{
 
 
  
function HomeProfile()
  {
    parent
::__construct();
    
$this->load->model("profiles");
    
$this->load->model("profileimages");
    
$this->load->helper(array('form''url'));

  
  function 
upload()
  
{
   $config[
'path''./images/';
   
$config['allowed_types''gif|jpg|jpeg|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('homeprofile/upload_form'$error);
  
}
  
else
  
{
   $file_data 
= array('upload_data' => $this->upload->data());
   
   
$data['img'base_url().'./images/'.$file_data['file_name'];

   
$this->load->view('homeprofile/upload_success'$data);
  
}
 }
   
 
 
 
Posted: 20 November 2012 09:17 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

First thought is double check its permissions.