EllisLab text mark
Advanced Search
1 of 2
1
   
“The upload path does not appear to be valid” (PULLING MY HAIR OUT !!!!) [SOLVED]
Posted: 07 June 2008 04:17 AM
Avatar
Joined: 2007-04-29
192 posts

I don’t understand why this stupid thing won’t work. The application works perfectly fine on my local server, but once I upload it to the actual site I get the “The upload path does not appear to be valid” error when I attempt to upload an image.

- The path of the image is at the root of both servers (local and remote), so I’ve set the path like this: $config[‘upload_path’] = ‘/uploads/’;

- I’ve already changed the mode of the file to 777

- I used an absolute path and it didn’t work. I even tried using ‘../../../../uploads’, but that doesn’t work either.

Is there anything else I could check? this is driving me crazy..

 
Posted: 07 June 2008 06:13 AM   [ # 1 ]   [ Rating: 1 ]
Joined: 2007-06-26
22 posts

Have your tried to

var_dump(is_dir('/upload/')); 

to see, if PHP can access the directory on the server?

Is this a shared server, then I don’t think that ‘/upload/’ is the correct path. Using

var_dump($_SERVER['SCRIPT_FILENAME']); 

you can find out the “real” path to your script - and thus to your “upload”-dir.

 
Posted: 07 June 2008 10:47 AM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-04-29
192 posts

If you were a girl, I’d make love to you.

Thanks man !! :D

 
Posted: 07 June 2008 05:08 PM   [ # 3 ]   [ Rating: 0 ]
Joined: 2007-06-26
22 posts

Glad I’m not smile

 
Posted: 07 November 2009 08:26 PM   [ # 4 ]   [ Rating: 1 ]
Joined: 2009-11-07
12 posts

All, i was having this issue on a local windows installation.  After some debugging, i found that although i was passing the config variables when loading the library, they were not being read properly.

In any case - to fix it, I simply called the initialization script right after i loaded the library, like so:

$config['upload_path''uploads';
$config['allowed_types''gif|jpg|png';
$config['max_size''2048';
$config['max_width''1024';
$config['max_height''768';

$this->load->library('upload'$config);
$this->upload->initialize($config); 
 
Posted: 27 August 2010 06:47 AM   [ # 5 ]   [ Rating: 0 ]
Joined: 2010-08-24
3 posts
MaDe - 07 June 2008 10:13 AM

Have your tried to

var_dump(is_dir('/upload/')); 
to see, if PHP can access the directory on the server?

You saved me too bro, cheers!

 
Posted: 25 February 2011 03:33 PM   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2011-02-25
14 posts

hi everybody,

var_dump(is_dir(’/upload/’));

return true, but the file did not uploaded!

i have this error: The upload path does not appear to be valid

ci is in this directory:

/var/www/ci/admin/

and i have used this directory for file uploading:

/var/www/ci/images/

regards

 
Posted: 02 March 2011 04:06 AM   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2011-02-25
14 posts

I found what was the problem!

with this line of code, the issue solved!

$this->upload->initialize($config);

regards

 
Posted: 07 May 2011 07:31 AM   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-07
58 posts

thx a alot!

I’ve tried for hours to set the path. Really annoying!=)

$this->upload->initialize($config);

This saved me! Thx a lot!

 
Posted: 07 May 2011 08:42 AM   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6707 posts

Why does everyone miss the period?

$config['upload_path''./uploads/'

./ up one directory!

InsiteFX

 Signature 

Certified State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

Skype: insitfx

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 07 May 2011 08:46 AM   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-07
58 posts

In my case it is not working with the period. It only works like that:

          $config[‘upload_path’] = ‘/Applications/MAMP/htdocs/gallery/’;
      $config[‘allowed_types’] = ‘gif|jpg|png’;
      $config[‘max_size’]  = ‘100’;
      $config[‘max_width’]  = ‘1024’;
      $config[‘max_height’]  = ‘768’;
     
      $this->upload->initialize($config);

Still dont know why…

 
Posted: 07 May 2011 09:16 AM   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2011-02-25
14 posts
crumpel - 07 May 2011 12:46 PM

In my case it is not working with the period. It only works like that:

          $config[‘upload_path’] = ‘/Applications/MAMP/htdocs/gallery/’;
      $config[‘allowed_types’] = ‘gif|jpg|png’;
      $config[‘max_size’]  = ‘100’;
      $config[‘max_width’]  = ‘1024’;
      $config[‘max_height’]  = ‘768’;
     
      $this->upload->initialize($config);

Still dont know why…

you just need to specify the upload pach, according to your CI root.

$config['upload_path''./gallery/'

whit this line of code, you mean that the images must be uploaded to a folder named “gallery” in your root, where you “index.php” is.

pay attention for this lines after your above code:

$this->load->library('upload'$config);
$this->upload->do_upload(); 
 
Posted: 07 May 2011 09:42 AM   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-07
58 posts

I tried $config[‘upload_path’] = ‘./gallery/’;  too. (gallery is my folder on MAMP/htdocs/ where alle my ci files are inside.
I do not understand how path works in CI.

I have a resize function with:

    $config[‘source_image’] = ‘mypic.png’;

and this is working. (http://localhost:8888/gallery/mypic.png)
This would mean the root is inside ...gallery/

Still dont get why it does not work with the upload_path without   “$this->upload->initialize($config);”

Thx for the help

 
Posted: 07 May 2011 09:47 AM   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2011-02-25
14 posts

please let us now what are the errors via this line of code:

print_r($this->upload->display_errors()); 

your root is where your index.php is.

 
Posted: 07 May 2011 10:01 AM   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-07
58 posts
if ( ! $this->upload->do_upload())
        
{
            print_r
($this->upload->display_errors());
            
        

This is how i implemented it.
Result just: “The upload path does not appear to be valid.”
greets

 
Posted: 07 May 2011 01:01 PM   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2011-02-25
14 posts

it is part of my recent project:

$config['upload_path''./test/';
        
$config['allowed_types''jpg|png';
        
$config['max_size']    '100';
        
$config['max_width']  '236';
        
$config['max_height']  '315';
        
$config['encrypt_name'TRUE;
        
    
$this->load->library('upload'$config);
        
$this->upload->initialize($config); 
        
$field_name "userfile";
        
    if(
$this->upload->do_upload("userfile")){
            
        $uploaded_image 
$this->upload->data();
        
print_r($uploaded_image);

    

feel free to use these lines of code.

please create a folder named ‘test’ in your CI root. also please ensure your field name & id is ‘userfile’.

 
1 of 2
1