Accessing another FTP user's dir from PHP
Posted by: jcwacky
Posted on: 2007-07-28 08:03:00
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/mydomain.com/manage.php 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
James