summaryrefslogtreecommitdiff
path: root/src/attachment_writer.php
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-05-10 21:39:13 +0000
committeruckelman <uckelman@nomic.net>2010-05-10 21:39:13 +0000
commit0b70991fe6bfff44a670446aba321891ba1fdc0d (patch)
tree696a54c84bb39a62a157473f8c23702be30fd2e3 /src/attachment_writer.php
parente39f8403c38ab055453ed9222dee43fd1d592b08 (diff)
Added file existance check.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6848 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src/attachment_writer.php')
-rw-r--r--src/attachment_writer.php5
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");