error ("notimage");
}
+function delete_from_ftp ($file) {
+ $ftp_conn = ftp_connect (FTPSERVER);
+ $login = ftp_login ($ftp_conn, FTPUSER, FTPPASS);
+ if ((!$ftp_conn) || (!$login)) {
+ server_error ();
+ }
+ $target = sprintf ("%s/%s", FTPIMGDIR, basename ($file));
+ $deleted = ftp_delete ($ftp_conn, $target);
+
+ if (!$deleted) {
+ server_error ();
+ }
+ ftp_close ($ftp_conn);
+}
+
+function send_to_ftp ($file) {
+ $ftp_conn = ftp_connect (FTPSERVER);
+ $login = ftp_login ($ftp_conn, FTPUSER, FTPPASS);
+ if ((!$ftp_conn) || (!$login)) {
+ server_error ();
+ }
+ $dest = sprintf ("%s/%s", FTPIMGDIR, basename ($file));
+ $upload = ftp_put ($ftp_conn, $dest, $file, FTP_BINARY);
+
+ if (!$upload) {
+ server_error ();
+ }
+ ftp_close ($ftp_conn);
+}
+
function save_uploaded_file ($file, $con) {
$dest = "";
if (isset ($file) && ($file ["error"] != UPLOAD_ERR_NO_FILE)) {
(!move_uploaded_file ($file ["tmp_name"], $dest))) {
server_error ();
}
+ send_to_ftp ($dest);
}
return basename_safe ($dest);
}
$path = UPLOADDIR . "/" . $imgpath;
if (file_exists($path)) {
unlink ($path);
+ delete_from_ftp ($path);
return true;
} else {
return false;
// title of your website
define ("SITETITLE", "SYP");
+// ftp server to store photos
+define ("FTPSERVER", "");
+
+// ftp user
+define ("FTPUSER", "");
+
+// ftp pass
+define ("FTPPASS", "");
+
+// ftp directory
+define ("FTPIMGDIR", "");
+
// email contact for webmaster.
define ("WEBMASTERMAIL", "");