How to implement a FTP page?
Moderator: General Moderators
How to implement a FTP page?
Is it possible to create a interface to log into an FTP site? I'm trying to ceate an interface so user can login with their user name and password and the have the option to log into our FTP server. Is this possible? What are the requirements and codes?
Thanks!
Thanks!
Many thanks for the help. I saw this site, http://web2ftp.com/ and I think something like this would work.
By the way, is ftp_connect() a command of PHP or FTP?
Again, thanks!
By the way, is ftp_connect() a command of PHP or FTP?
Again, thanks!
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
It's php.. but it connects to ftp servers via ftp protocols
http://ca.php.net/ftp_connect
Many thanks for the help. I used this codes:
And I got connected; however, I do not see my files and folders listed. I'm definitely missing something. In addition, once I got connected and it shows my folder and files, can I just drag and drop files into it or from it?
Thank you.
Code: Select all
// set up basic connection
$conn_id = ftp_connect("myWebsite.com");
$ftp_user_name = $_SESSION['kt_login_user'];
$ftp_user_pass = $_SESSION['kt_pssWord'];
$ftp_server = "My Sever";
$ftp_user_name = $ftp_user_name;
//echo "user Name: ".$ftp_user_name."<br> Password: ".$ftp_user_pass."<br>";
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}Thank you.
Many thanks for your help. I'm totally new to this FTP thing inside a browser using PHP. Your help are very much appreciated.
Here is what I found out so far about the problem. According to the FTP server log, when I got connected somehow I automatically got disconnected or closed again. What would have caused that?
Here is what I found out so far about the problem. According to the FTP server log, when I got connected somehow I automatically got disconnected or closed again. What would have caused that?
Okay, I guess I've been thinking too hard here. Simple question. I found that I can do this, ftp.mysite.com, on the MS IE browser as the address and it would automatically log me into the Anonymous account folder. Now, how do I do change this, ftp.mysite.com, so that when I log in it will automatically go to a particular user's folder?
Thanks!
Thanks!
No. it's username:password@ftp.domain.comljCharlie wrote:Yes, I understand that I need to login as the user and with his password but what's the actual method. For example:
Do I type in like this, ftp.mysite.com:myusername:myPassword/myfolder or something different?
Okay, thanks that works! Now, here's the question. What are the advantages and disadvantages of creating my own PHP FTP client interface and just do something like this:
The one problem I found so far with this simple method is that when you mouse over the link, the user name and password is showing in the browser's status bar at the bottom. In addition, if you go to view source the user name and password is also there and I'm guessing it is in the browser's cache directory as well. That means anyone can login to the FTP server if the user does not lock his/her computer.
Any suggestion on the best option with the least amount of work to implement?
Code: Select all
<a href="ftp://<?php echo $ftp_user_name; ?>:<?php echo $ftp_user_pass; ?>@myDomain.com">FTP Click here</a>Any suggestion on the best option with the least amount of work to implement?