Welcome Guest, Not a member yet? Register   Sign In
The upload path does not appear to be valid. could it be the CI upload library not working
#1

[eluser]whitepaper[/eluser]
From CI user guide controller
Code:
<?php

class Upload extends CI_Controller {
    

    
    function index()
    {    
        $this->load->view('upload_view', 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_view', $error);
        }    
        else
        {
            $data = array('upload_data' => $this->upload->data());
            $this->load->view('upload_success', $data);
        }
    }    
}
?>

view
Code:
<html>
<head>
<title>Upload Form</title>
</head>
<body>

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

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
still not working when i run it. I am getting an error 'The upload path does not appear to be valid.' spent whole day trying to get solution but to no avail. Any body with an Idea? :gulp:
#2

[eluser]danmontgomery[/eluser]
A relative path is relative to the location of index.php, is that where your uploads folder is? Are permissions correctly set?
#3

[eluser]whitepaper[/eluser]
Thanks for reply. Yes I have set it at the right place and also given rights to the folder uploads.

CI |-application
|-database_model
|-system
|-index.php
|-uploads (permissions granted)
|-user-guide

When i run this

///////////////////////////////////
Code:
$this->load->library('upload', $config);
$this->upload->initialize($config);
var_dump($this->upload->do_upload());

I get
//////////////////////////////////
bool(false)

When I run this

///////////////////////////////////////////////////////////////////////
Code:
if (!$this->upload->do_upload())
        {
    print_r($this->upload->data());
        $error = array('error' => $this->upload->display_errors());
        $this->load->view('upload_view', $error);
        }
I get
////////////////////////////////////////////////////////////////////////
Array ( [file_name] => title.jpg [file_type] => image/jpeg [file_path] => /users/whitepaper/Sites/2goo/uploads/ [full_path] => /users/whitepaper/Sites/2goo/uploads/title.jpg [raw_name] => title [orig_name] => [file_ext] => .jpg [file_size] => 21.33 [is_image] => 1 [image_width] => [image_height] => [image_type] => [image_size_str] => )
#4

[eluser]whitepaper[/eluser]
I now think its the new CodeIgniter 2.02 with a problem with uploading i have had to download CodeIgniter_2.0.0 and is working fine. Please confirm if this is the case




Theme © iAndrew 2016 - Forum software by © MyBB