Welcome Guest, Not a member yet? Register   Sign In
FTP Problem
#1

[eluser]Justin Patel[/eluser]
Hello All,
I am trying to upload images using ftp. Using below code I got the list of files in the directory.

But I am unable to upload image, It gives error like
" Unable to locate the source file. Please check your path. "

I have stuck here form last 7-9 hors.

Please give me some solution...


Code:
$path = 'd:\test.gif';

$this->load->library('ftp');
$config['hostname'] = 'XXXXXXXX.net';
$config['username'] = 'XXXXX';
$config['password'] = 'XXXXX';
$config['debug'] = TRUE;
$this->ftp->connect($config);
$DestPath = '/public_html/projects/affiliate/listingImages/';
$this->ftp->upload($path, $DestPath, 'ascii', 0777);
$list = $this->ftp->list_files('/public_html/projects/affiliate/listingImages/');
                                
print_r($list);
$this->ftp->close();

Some time it gives error " Unable to upload the specified file. Please check your path. "



Thanks for viewing Smile
#2

[eluser]gtech[/eluser]
I dont know for sure as I havnt tried it.. but I would try and move the gif file relative to your codeigniter install directory..

eg.

c:\xampp\htdocs\codeigniter_install\images\test.gif

then modify the code:

Code:
$path = './images/test.gif';
#3

[eluser]Phil Sturgeon[/eluser]
Indeed, the FTP source path needs to be a relative path on your web server (meaning you can upload from your local pc if you are running the script on localhost, but not otherwise).
#4

[eluser]gtech[/eluser]
I must admit that wasn't overly clear on the documentation, as case for a slight modification?
#5

[eluser]nikolaaa[/eluser]
I have the same problem...have try all combination from full path to local...but always the same error "Unable to upload the specified file. Please check your path."

Any idea what could be a problem?
#6

[eluser]nikolaaa[/eluser]
hm...I foind that code pass this part

Code:
if ( ! file_exists($locpath))
        {
            $this->_error('ftp_no_source_file');
            return FALSE;
        }

So, there script can see my file. But error is from this part:

Code:
$result = @ftp_put($this->conn_id, $rempath, $locpath, $mode);
        
        if ($result === FALSE)
        {
            if ($this->debug == TRUE)
            {
                
                $this->_error('ftp_unable_to_upload');
            }

This code is from FTP class file.
#7

[eluser]Unknown[/eluser]
This is coming more than 6 years later, so this probably won't be of much help to the OP, but I thought I'd post a solution for other people who are also running into this problem. The issue is that $DestPath needs to be file path, not just a folder path. In otherwords you need to concatenate a destination filename to the path.

$DestPath = '/public_html/projects/affiliate/listingImages/test.gif';

instead of

$DestPath = '/public_html/projects/affiliate/listingImages/';

Hope this helps someone out!




Theme © iAndrew 2016 - Forum software by © MyBB