im having a huge problem with setting up a very basic browser-based ftp application. all i want to do at this point is upload a few images into a folder in my root directory. the form page requests that three files be uploaded from a local directory to my ftp. here is the action code:
error_reporting(E_ALL);
$server="server";
$user="user";
$pass="password";
$conn_id=ftp_connect($server);
$login=ftp_login($conn_id,$user,$pass);
ftp_chdir($conn_id,"ftpimages");
foreach ($_POST as $file) {
$file_a=substr(strrchr($file,"\\"),1);
if (!ftp_put($conn_id, $file_a, $file, FTP_BINARY)) {
echo "Could not upload $file_a<br /><br />";
} else {
echo "Uploaded $file_a<br /><br />";
}
}
if (ftp_close($conn_id)) {
echo "Connection closed!<br /><br />";
} else {
echo "Connection could not close!<br /><br />";
}
there are two problems in the finished script:
1) there are errors such as "Warning: ftp_put(): error opening "soandso"" , and thus, the images will not upload.
2) the ftp connection will not close. i suspect this is due to the warnings beforehand, but i dont know.
any help would be greatly appreciated, thankee!