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

[eluser]Phil Sturgeon[/eluser]
Right, having a bad day with some FTP and need a spot of help if you can.

I have added a FTP download function into my MY_FTP class to download from one server to my local one. However the code below:

Code:
function download($rempath, $locpath, $mode = 'auto')
    {
        if ( ! $this->_is_conn())
        {
            return FALSE;
        }
    
        // Set the mode if not specified
        if ($mode == 'auto')
        {
            // Get the file extension so we can set the upload type
            $ext = $this->_getext($rempath);
            $mode = $this->_settype($ext);
        }
        
        $mode = ($mode == 'ascii') ? FTP_ASCII : FTP_BINARY;
        
        $result = ftp_get($this->conn_id, $locpath, $rempath, $mode);

        if ($result === FALSE)
        {
            if ($this->debug == TRUE)
            {
                $this->_error('ftp_unable_to_download');
            }        
            return FALSE;        
        }
        
        return TRUE;
    }

Returns the error:

Quote:Severity: Warning

Message: ftp_get() [function.ftp-get]: open_basedir restriction in effect. File(/public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv) is not within the allowed path(s): (/home/engage5d:/usr/lib/php:/usr/local/lib/php:/tmp)

Filename: libraries/MY_Ftp.php

However it shouldnt be complaining about /public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv as im trying to grab the file from the flash media server, which is /sdfskfhsj/vportal1/streams/_definst_/ so... what the hell? How do I fix this error?

Also, why does the code:

Code:
$this->ftp->upload('/public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv',
             $this->config->item('video_folder').'7782c5f1954255628bb10c26d8a4597f.flv');

give me a "cant find source file" error when im bloody certain that file is there?!! The remote folder may be incorrect, but the local folder is damn right!
#2

[eluser]coolfactor[/eluser]
Okay, calm down pyro, we don't want you starting any fires now. :-)

I'll do some digging around for you.
#3

[eluser]coolfactor[/eluser]
Code:
'/public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv'

I'm concerned about that leading slash. That might be telling the FTP server to start at the root, and look for a folder called "public_html". Try removing that leading slash to see if there's any improvement.
#4

[eluser]Phil Sturgeon[/eluser]
In both cases (upload and download) no trailing slash has no effect.


Code:
// Upload video to Media Server
        $this->ftp->connect('media_server');
        
        print_r($this->ftp->list_files('/gdf3sv560h/vportal1\streams\_definst_'));
        
        $this->ftp->download('gdf3sv560h/vportal1/streams/_definst_/7782c5f1954255628bb10c26d8a4597f.flv',
                         'public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv');
        
        $this->ftp->upload('public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv',
                         'gdf3sv560h/vportal1/streams/_definst_/7782c5f1954255628bb10c26d8a4597f.flv');
        
        $this->ftp->close();

List files works but the other two give me constant crap (obviously im only running one at a time, commenting the others out).
#5

[eluser]coolfactor[/eluser]
You say the "list" works, but what the heck is the deal with this path:
Code:
'/gdf3sv560h/vportal1\streams\_definst_'

Why the forward and backward slashes?
#6

[eluser]coolfactor[/eluser]
Are you still getting the "open_basedir restriction in effect" in both cases? Please elaborate on what you get for downloading, and what you get for uploading, separately.

Have you researched the "open_basedir restriction in effect" issue? There's plenty online about it.
#7

[eluser]Phil Sturgeon[/eluser]
Thats the media server im connecting too. I want to move a flv file from in there, to the /public_html/tmp/ on my server. I also need to be able to upload to that server too, but cant get files going either way!
#8

[eluser]johnwbaxter[/eluser]
Have you tried setting open_basedir in your conf to none?

I hate open_basedir with a passion.
#9

[eluser]Crimp[/eluser]
FTP. Grrr.

Anyone still working on the IPoAC CI library?
#10

[eluser]Phil Sturgeon[/eluser]
Carrier pidgeon might be quicker than this crap.

OK, lets start with why I cant upload. If I connect to my local server as the FTP server and do this...

Code:
print_r($this->ftp->list_files('/public_html/tmp'));

then I see all my files, includuing 7782c5f1954255628bb10c26d8a4597f.flv. If I copy that exact path in, and connect to the media server in FTP then it says "Unable to find source". Which makes me think... wtf?

Code:
$this->ftp->upload('/public_html/tmp/7782c5f1954255628bb10c26d8a4597f.flv',
        '/gdf3sv560h/vportal1/streams/_definst_/test.flv');




Theme © iAndrew 2016 - Forum software by © MyBB