ftp+php
-
Can anyone give me a simplest possible example for using ftp with php technology? I will be very much thankful. Ranjan Goyal
look in the php manual. the best documentation i have ever seen. -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298
-
look in the php manual. the best documentation i have ever seen. -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298
I want a very basic working example. e.g Reading a file from remote machine, displaying it on my textbox and then on a button click to save that file in the same place. At present I am not able to read file. My machine no is 192.168.0.6 Below is the code that I am using "; $fp=fopen("ftp://\*\*\*\*\*\*:\*\*\*\*\*@192.168.0.60/ranjan/downDb.php",r); $contents = fread ($fd, 100);//100 is file size here echo"$contents"; echo""; ?> Below is the error generated Warning: fopen(ftp://...@192.168.0.60/ranjan/downDb.php): failed to open stream: FTP server reports 550 Could not get file size. in /home/small_projects/ranjan/ftp.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in /home/small_projects/ranjan/ftp.php on line 4
-
I want a very basic working example. e.g Reading a file from remote machine, displaying it on my textbox and then on a button click to save that file in the same place. At present I am not able to read file. My machine no is 192.168.0.6 Below is the code that I am using "; $fp=fopen("ftp://\*\*\*\*\*\*:\*\*\*\*\*@192.168.0.60/ranjan/downDb.php",r); $contents = fread ($fd, 100);//100 is file size here echo"$contents"; echo""; ?> Below is the error generated Warning: fopen(ftp://...@192.168.0.60/ranjan/downDb.php): failed to open stream: FTP server reports 550 Could not get file size. in /home/small_projects/ranjan/ftp.php on line 3 Warning: fread(): supplied argument is not a valid stream resource in /home/small_projects/ranjan/ftp.php on line 4
from the php manual: -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298
-
from the php manual: -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298
Hi Raoul, First very sorry for this delayed response. Today, I tried the following code and I got the following error: Fatal error: Call to undefined function: ftp_connect() in /home/small_projects/ranjan/ALLFILES/ftp.php on line 12 192.168.0.112 is IP of a folder on NT server Code is this: // set up basic connection $ftp_server="http://192.168.0.112/Ranjan"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name="********"; $ftp_user_pass="********"; $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"; } Ranjan
-
Hi Raoul, First very sorry for this delayed response. Today, I tried the following code and I got the following error: Fatal error: Call to undefined function: ftp_connect() in /home/small_projects/ranjan/ALLFILES/ftp.php on line 12 192.168.0.112 is IP of a folder on NT server Code is this: // set up basic connection $ftp_server="http://192.168.0.112/Ranjan"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name="********"; $ftp_user_pass="********"; $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"; } Ranjan
> // set up basic connection > $ftp_server="http://192.168.0.112/Ranjan"; > $conn_id = ftp_connect($ftp_server); first problem i see is that "http://" - remember, you are trying to connect to an FTP server... not an HTTP server... try changing that and see what you get... -- Raoul Snyman Saturn Laboratories e-mail: raoul.snyman@saturnlaboratories.co.za web: http://www.saturnlaboratories.co.za/ linux user: #333298