diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/attachment_writer.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/attachment_writer.php b/src/attachment_writer.php index 571827c..fb7d144 100644 --- a/src/attachment_writer.php +++ b/src/attachment_writer.php @@ -50,6 +50,11 @@ foreach ($_FILES as $file) { $src = $file['tmp_name']; $dst = $attach_dir . '/' . $file['name']; + # Destination file should not exist, don't overwrite + if (file_exists($dst)) { + die('Destination file already exists: ' . $dst . "\n"); + } + # Move temp file to attachments dir if (!move_uploaded_file($src, $dst)) { die("Failed to move $src to $dst.\n"); |