Php – issues in loading file to ftp server



Hello all,

I have been long laboring to upload an excel file into an ftp server.

Now I linked to the ftp however am receiving an error stating that the file couldn't be uploaded.

Please see below my code-

//Send the FTP Connection and send the Excel file to the ftp server 
$ftp_server = "xxxxxxxxx";
$ftp_user = "xxxx";
$ftp_pass = "xxxxxxxxxx";
$file = 'xls/AB-MXRPayment.xls';
$fp = '/AB-MXRPayment.xls';
// set up a connection or die
$conn_id = ftp_connect($ftp_server , 20 ) or die("Couldn't connect to $ftp_server"); 
 
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected as $ftp_user@$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
 
if (@ftp_put($conn_id, $fp, $file, FTP_ASCII)) {
echo "Successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
 
// close the connection
ftp_close($conn_id); 

and here is the answer I am getting:

Connected as user1@80.45.12.74 There was a problem while uploading xls/AB-MXRPayment.xls 

Pls help me.

thank you very much.