You are here: Re: Determine path to FTP base directory? « All PHP « IT news, forums, messages
Re: Determine path to FTP base directory?

Posted by Jerry Stuckle on 03/19/07 14:10

Markus wrote:
> Hello
>
> Is it possible to determine the PHP path to the FTP base directory?
> ftp_pwd($conn_id) returns '/', while I need something like
> '/data/users/domain.com/'.
>
> I used a construct such as:
>
> $list = ftp_nlist($conn_id, ftp_pwd($conn_id));
> foreach ($list as $entry) {
> if (stristr($_SERVER['DOCUMENT_ROOT'], '/'.$entry)) {
> $split = explode($entry, $_SERVER['DOCUMENT_ROOT']);
> $ftp_basedir = $split[0];
> break;
> }
>
> That works well in most cases; anyway now I have a case where
> $_SERVER['DOCUMENT_ROOT'] has a duplicate folder name, such as
> '/data/htdocs/domain.com/htdocs/', which makes the above process fail. I
> think of complicated things like have FTP write a file into the base
> directory, and let PHP search for it, but I hope there is an easier method!
>
> Thanks for a comment
> Markus

Which "ftp base directory"? Every user can have a different one.

And as you've found, the directory the user sees is relative to his ftp
root. The ftp user has no knowledge of any directory outside of his own
root - which is how it should be.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация