I am trying to upload a photo to my ftp server. Here is te html code:
<html>
<body>
<form enctype="multipart/form-data" action="db.php" method="POST">
Choose a file to upload:
<input name="file" type="file" />
<br/>
<input type="submit" value="Upload File" />
</form>
</body>
</html>
And it is my php code:
<?php
$ftp_server="myserver";
$ftp_user_name="username";
$ftp_user_pass="pass";
$file = $_FILES['file']['name'];
$remote_file = "x.png";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$upload = ftp_put($conn_id, $remote_file, $file, FTP_ASCII);
if(move_uploaded_file ($file , "/photos")) {
echo "successfully uploaded $file\n";
exit;
} else {
echo "There was a problem while uploading $file\n";
exit;
}
ftp_close($conn_id);
?>
but when i trying to upload a file it show an error like:
Warning : ftp_put(o.png) [function.ftp-put ]: failed to open stream: No such file or directory in /home/ a1268559/public_html/ profile/db.php
Please help me