hno Posted February 13, 2010 Share Posted February 13, 2010 HI I'm writing a back up script that It uses ftp function for transfering files to the remote host . I have write this code but it isn't upload them .It has connected to the host but it couldn't transfer the files and says "There was a problem while uploading" according to this code : ....... ....... // file to move: $local_file = 'Install.htm'; $ftp_path = 'Install.htm'; $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); if (ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } ftp_close($conn_id); what is the problem ? thanks Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/ Share on other sites More sharing options...
RussellReal Posted February 13, 2010 Share Posted February 13, 2010 you probably don't have access to write to the directory you start in.. try changing directories. Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1011695 Share on other sites More sharing options...
hno Posted February 13, 2010 Author Share Posted February 13, 2010 you probably don't have access to write to the directory you start in.. try changing directories. I changed the path but it wasn't work how can I do so ? Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1011698 Share on other sites More sharing options...
Zane Posted February 13, 2010 Share Posted February 13, 2010 What did you change the path to, would be pretty useful to know? When you FTP something you have to give the explicit.. absolute path to where it's going.. not just "install.htm" There could be 300 install.htm's on that FTP server. an example path would be $ftp_path = "/public_html/MyAwesomeInstaller"; Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1011753 Share on other sites More sharing options...
hno Posted February 15, 2010 Author Share Posted February 15, 2010 What did you change the path to, would be pretty useful to know? When you FTP something you have to give the explicit.. absolute path to where it's going.. not just "install.htm" There could be 300 install.htm's on that FTP server. an example path would be $ftp_path = "/public_html/MyAwesomeInstaller"; i changed the ftp_path to "$ftp_path = '"/public_html/sssss.htm';" but it didn't make different Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1012427 Share on other sites More sharing options...
hno Posted February 15, 2010 Author Share Posted February 15, 2010 What did you change the path to, would be pretty useful to know? When you FTP something you have to give the explicit.. absolute path to where it's going.. not just "install.htm" There could be 300 install.htm's on that FTP server. an example path would be $ftp_path = "/public_html/MyAwesomeInstaller"; i changed the ftp_path to "$ftp_path = '"/public_html/sssss.htm';" but it didn't make different please help me , have you written a ftp function to making back ups from your files ? plz , give me some examples thanks Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1012558 Share on other sites More sharing options...
Zane Posted February 16, 2010 Share Posted February 16, 2010 it may be as RusselReal already put it. You only have read privileges. If you have access to the Server itself that FTP is hosted on, then you should change the permissions on the files to 0755 for the ftp username you're ..... using. Link to comment https://forums.phpfreaks.com/topic/191940-problem-using-ftp/#findComment-1012916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.