Re: [PHP] Question about using ftp_put() for copying files



What puzzles me is that one path must be absolute and the other relative to the root. And, I've got chdir to the destination dir.

I know about ftp having its own root. In my code, I have a check to make certain the ftp root is the same as the $_SERVER[document_root].

Richard Lynch wrote:

On Thu, May 24, 2007 2:37 pm, Al wrote:
Can anyone explain what's going on.

If I assign $source= $source_dir . $file;
$source_dir is the absolute path i.e.,
/home/xxxxx/public_html/EditPage/

And $dist= $dist_dir . $file;
$dist_dir is simply relative to $_SERVER[document_root]; i.e., just
plain /test

To get ftp_put() to work, I must first chdir to the $dist_dir.

ftp_chdir($dist_dir);
ftp_put($conn_id, $dist, $source, flag];

Similar to 'document_root', FTP has its own idea of where a "root"
directory is for each login/user.

In your case, it would appear by coincidence to match up with
'document_root' -- well, perhaps not "coincidence" since many webhosts
restrict their users' FTP accounts to only be their own web
directories, so they can't go poking around in other people's stuff
quite as easily.

.



Relevant Pages

  • Re: Mandrake 8.1 Desktop Gone
    ... You want to set up anonymous ftp with a chroot jail. ... Use chmod to remove "others" access to all directories in root. ... database using the same package specification ...
    (alt.os.linux)
  • Re: root access denied via SSH
    ... After adding this user and modifying it to have root ... When you say users have lost access only via ssh, ... for FTP access and never SSH access. ...
    (comp.unix.questions)
  • Re: LWP::Simple getstore with absolute path not working
    ... When a user logs in via ftp, ... Actually this is server/config dependant. ... example on my personal system, if I login in as a run of the mill user, ... is used), or the true root of the system, in which case you referernce ...
    (comp.lang.perl.misc)
  • [OpenPKG-SA-2002.007] OpenPKG Security Advisory (mm)
    ... Vulnerability: local root exploit ... on creating temporary files in the OSSP mm library. ... $ ftp ftp.openpkg.org ... Now proceed and rebuild and reinstall all dependent OpenPKG packages, ...
    (Bugtraq)
  • Re: Automate FTP account creation
    ... i.e when user register to website then an FTP account ... not give you root access. ... You could do it by executing a PHP script which switches to the root ...
    (comp.lang.php)

Loading