Check to not overwrite upload if file_exists.

This commit is contained in:
Retro_Guy 2023-09-09 06:12:05 -07:00
parent 91705fdb1f
commit 7af6e32304
1 changed files with 9 additions and 4 deletions

View File

@ -454,10 +454,15 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
if ($do_attach) {
move_uploaded_file($_FILES["photo"]["tmp_name"], $attachment_temp_dir . $_FILES["photo"]["name"]);
if ($authname != null) {
if (! is_dir($spooldir . '/upload/' . $authname)) {
mkdir($spooldir . '/upload/' . $authname);
$uploadname = $authname;
} else {
$uploadname = $CONFIG['anonusername'];
}
copy($attachment_temp_dir . $_FILES["photo"]["name"], $spooldir . '/upload/' . $authname . '/' . $_FILES["photo"]["name"]);
if (! is_dir($spooldir . '/upload/' . $uploadname)) {
mkdir($spooldir . '/upload/' . $uploadname);
}
if (! file_exists($spooldir . '/upload/' . $uploadname . '/' . $_FILES["photo"]["name"])) {
copy($attachment_temp_dir . $_FILES["photo"]["name"], $spooldir . '/upload/' . $uploadname . '/' . $_FILES["photo"]["name"]);
}
}
$ns = nntp_open($server, $port);