From 0b70991fe6bfff44a670446aba321891ba1fdc0d Mon Sep 17 00:00:00 2001 From: uckelman Date: Mon, 10 May 2010 21:39:13 +0000 Subject: Added file existance check. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6848 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/attachment_writer.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/attachment_writer.php') 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"); -- cgit v1.2.3