yolop Posted October 22, 2008 Share Posted October 22, 2008 hi i can to get chmod to file with ftp function like that ftp_chmod($conn_id, 0777, $x); and i can to creat a folder with ftp function like that ftp_mkdir($conn_id,$x); i want to copy file with ftp function how please?? Quote Link to comment https://forums.phpfreaks.com/topic/129551-want-to-copy-files-with-ftp-function/ Share on other sites More sharing options...
JonnoTheDev Posted October 22, 2008 Share Posted October 22, 2008 using ftp_fput Quote Link to comment https://forums.phpfreaks.com/topic/129551-want-to-copy-files-with-ftp-function/#findComment-671650 Share on other sites More sharing options...
yolop Posted October 22, 2008 Author Share Posted October 22, 2008 i saw that <?php // open some file for reading $file = 'somefile.txt'; $fp = fopen($file, 'r'); // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to upload $file if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) { echo "Successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection and the file handler ftp_close($conn_id); fclose($fp); ?> where is the target that i copy ? i mean that if I want to copy "1.php" to pic/1.php i didn't fint in that fuction where i need to write "pic/" Quote Link to comment https://forums.phpfreaks.com/topic/129551-want-to-copy-files-with-ftp-function/#findComment-671652 Share on other sites More sharing options...
JonnoTheDev Posted October 22, 2008 Share Posted October 22, 2008 Using ftp_mkdir . If you are basically making a program that will read directories and files from a source location and transfer them recursively you will need a function (recursive) that can read your source directory then create it at the destination, read files within and transfer them, then move onto the next directory, etc until all folders and files are replicated. Just do some Googling on FTP tutorials for php. Preferably transferring files and folders. Quote Link to comment https://forums.phpfreaks.com/topic/129551-want-to-copy-files-with-ftp-function/#findComment-671657 Share on other sites More sharing options...
yolop Posted October 22, 2008 Author Share Posted October 22, 2008 i didn't undersant what did you say that function can to copy file??? how? Quote Link to comment https://forums.phpfreaks.com/topic/129551-want-to-copy-files-with-ftp-function/#findComment-671659 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.