I am hosting my website on server1 and I am trying to upload an attachment file to Server2. Here is the script, after uploading the files getting message "successfully uploaded /tmp/phpjmhXhk", but could not see any file on the Server2.
<?php
$ftp_server = "ftp.xlphp.net";
$ftp_user_name = "xl_2025****";
$ftp_user_pass = "******";
//Upload MS Word File to different Server using ftp
if ((isset($_POST["MM_upload"])) && ($_POST["MM_upload"] == "form1")) {
// UPLOAD TO DIFFERENT SERVER // TESTING
$RESUMENAME=$_FILES['CANDRESUME'] ['name'];
$UploadTmp=$_FILES['CANDRESUME']['tmp_name'];
$UploadType=$_FILES['CANDRESUME']['type'];
$UploadExtn=substr($RESUMENAME, strpos($RESUMENAME, '.')+1);
$FileSize=$_FILES['CANDRESUME']['size'];
$file = $UploadTmp;
$remote_file=$RESUMENAME;
echo "File".$file."</br>";
echo "RemoteFile".$remote_file."</br>";
$conn_id = ftp_ssl_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_pasv($conn_id, true);
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
// close the connection
ftp_close($conn_id);
// UPLOAD TO DIFFERENT SERVER // TESTING === ENDS
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="200" border="1">
<tr>
<td>FILE UPLOAD WITH FTP</td>
</tr>
<tr>
<td><label for="CANDRESUME"></label>
<input type="file" name="CANDRESUME" id="CANDRESUME" /></td>
</tr>
<tr>
<td><input type="submit" name="Upload" id="Upload" value="Submit" />
<input name="MM_upload" type="hidden" id="MM_upload" value="form1" /></td>
</tr>
</table>
</form>
</body>
</html>
I tried $conn_id = ftp_ssl_connect($ftp_server, 21); also