From 55642a6bcdc357f40a4ffc2dd385f582bd2cd2fe Mon Sep 17 00:00:00 2001
From: Joshua Myers
Date: Wed, 31 Jan 2024 14:18:40 -0600
Subject: [PATCH 1/2] Added 'Overwrite Files' Checkbox to Give Users the Option
of Overwriting Existing Files During Upload
---
tinyfilemanager.php | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tinyfilemanager.php b/tinyfilemanager.php
index ca73f9d..380e187 100644
--- a/tinyfilemanager.php
+++ b/tinyfilemanager.php
@@ -927,6 +927,7 @@ if (!empty($_FILES) && !FM_READONLY) {
$chunkIndex = $_POST['dzchunkindex'];
$chunkTotal = $_POST['dztotalchunkcount'];
$fullPathInput = fm_clean_path($_REQUEST['fullpath']);
+ $overwrite_files = ($_REQUEST['overwrite_files'] ?? 'N');
$f = $_FILES;
$path = FM_ROOT_PATH;
@@ -1016,7 +1017,15 @@ if (!empty($_FILES) && !FM_READONLY) {
if ($chunkIndex == $chunkTotal - 1) {
if (file_exists ($fullPath)) {
$ext_1 = $ext ? '.'.$ext : '';
- $fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) .'_'. date('ymdHis'). $ext_1;
+
+ if($overwrite_files == 'Y')
+ {
+ $fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) . $ext_1;
+ }
+ else
+ {
+ $fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) .'_'. date('ymdHis'). $ext_1;
+ }
} else {
$fullPathTarget = $fullPath;
}
@@ -1354,11 +1363,13 @@ if (isset($_GET['upload']) && !FM_READONLY) {
:
+