Jump to content

Recommended Posts

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

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

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

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.