Accessing another FTP user's dir from PHP

In short:
I wish to be able to access a directory which is in a separate user’s account using PHP, so that I can copy the files into my main account to process them using PHP.

In long:
I am developing a video sharing site for a client, which as well as showing flv’s of the videos, also shares the original high quality .avi file for use in video production.

Uploading many large .avi files (average size 100mb) using a HTTP form upload is obviously not ideal. However most users will only be uploading a few occasionally which will be fine.

But for a few users they will wish to upload alot of large files, so FTP would be better.

Ideally it would be nice to be able to create an FTP account for each user which would be restricted to just have access to their own folder on the main account. So that they could upload their videos and then log in to the control panel on my site where they could enter all the details for their uploaded videos like title description etc, this would also convert the videos.

But this is not possible, because only 1 FTP account can access a domain.

So if I were to create individual FTP accounts, is there a way for my main site to access the uploaded files in these accounts and copy them over to the main site using FTP?

So could I have /home/user1/ read and write to /home/user2/upload/ ? Using PHP functions such as mkdir() etc. Is there a way to give PHP the username and password it needs to access this dir?

Is this possible? Is there a different solution?

Many Thanks

Is there a reason dreamhost choose not to allow you to add more FTP users to the same site? Just about all other hosting companies appear to do it. Even the most secure/careful ones.

I am still after a solution if one exists? I may have to move host if not.

Many Thanks

That is not the right way to think about it. HTTP has nothing to do with FTP.

A machine cluster has users.

An FTP server daemon allows users to upload and download files within their home directories.

An HTTP server daemon serves a web site by looking for files inside a specific directory called a document root.

More than one web site can have the same document root, but there is only one document root per web site.

And the document root will reside in the home directory of a single user of course.

Have you heard of permissions and user groups yet?

Yes and no. Plain FTP access is restricted to the home directory of the user you logged in as - meaning to use FTP both ways, you have to download the file from logged in as one user then upload it after logging in as the other user. Using SFTP you would still have to download and upload, but you only need to login as the user you need to upload to.

Yes, theorectically. I code in Perl and would have no problem sharing files between users.

:cool: -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7

Thanks for your reply Atropos.

To be clear, when I said “But this is not possible, because only 1 FTP account can access a domain.” I meant that it was not possible on dreamhost due to the restrictions they have put in. I am using more than 1 FTP account to access the same website/domain and the same folders fine on other hosting companies.

I have heard of permissions and user groups, but I am struggling to get PHP to obey them.

Thank you for letting me know that it is possible in perl. That is promising, but I don’t really want to have to resort to having to write a perl script which I have no experience in when this should a lot be a lot simpler.

I do appreciate your help though.