Hi
I am using a form to upload an image from my hard drive to my server but there
is something amiss cause I am continually getting an error message "FTP upload
has failed"
This is my code
<?php
if (!isset($_POST['upload'])) {
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p align="left"><font size="2">Type the file to upload here </p>
<input type="text" name="filename" size="25">
<input type="submit" value="Upload" name="upload" style="color: #000000;
font-family: Arial; background-color: #D56A00; border-style: solid;
border-color: #FF0066"></p>
</form>
<?php
}
else {
$source = "D:\\My Documents\\My Pictures\\" . $_POST['filename'];
$destination = "/images/".$_POST['filename'];
$ftp_server = "myftpserver";
$ftp_user_name = "myusername";
$ftp_user_pass = "mypassword";
$conn_id = ftp_connect($ftp_server) or die ("Could not connect to $ftp_server");
$login_result = ftp_login($conn_id,$ftp_user_name,$ftp_user_pass);
if((!$conn_id)||(!$login_result)) {
echo "FTP connection has failed";
exit;
}
else {
echo "Connected to FTP server";
$upload = ftp_put($conn_id,$destination,$source,FTP_BINARY);
if (!$upload) {
echo "FTP upload has failed";
}
else {
echo "Successfully uploaded file";
}
}
}
?>
</body>
</html>
Any help greatly appreciated as always