Skip to content

Commit

Permalink
Allow overwrites in the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
lux committed May 30, 2020
1 parent 08ab442 commit fa716c9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
3 changes: 2 additions & 1 deletion apps/filemanager/handlers/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
'Are you sure you want to delete this folder and all of its contents?',
'Your browser does not support drag and drop file uploads.',
'Please upload fewer files at a time.',
'The following file is too large to upload'
'The following file is too large to upload',
'Overwrite existing file?'
));

echo $tpl->render ('filemanager/index', $o);
6 changes: 0 additions & 6 deletions apps/filemanager/handlers/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@

for ($i = 0; $i < count ($_FILES['file']['name']); $i++) {
$_FILES['file']['name'][$i] = trim (urldecode ($_FILES['file']['name'][$i]));
if (@file_exists ($root . $_POST['path'] . '/' . $_FILES['file']['name'][$i])) {
$page->title = __ ('File Already Exists') . ': ' . $_FILES['file']['name'][$i];
echo '<p>' . __ ('A file by that name already exists.') . '</p>';
echo '<p><a href="/filemanager">' . __ ('Back') . '</a></p>';
return;
}
if (strpos ($_FILES['file']['name'][$i], '..') !== false) {
$page->title = __ ('Invalid File Name') . ': ' . $_FILES['file']['name'][$i];
echo '<p>' . __ ('The file name contains invalid characters.') . '</p>';
Expand Down
4 changes: 0 additions & 4 deletions apps/filemanager/handlers/upload/drop.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
return;
}

if (@file_exists ($root . $_POST['path'] . '/' . $_FILES['file']['name'])) {
echo json_encode (array ('success' => false, 'error' => __ ('A file by that name already exists.')));
return;
}
if (strpos ($_FILES['file']['name'], '..') !== false) {
echo json_encode (array ('success' => false, 'error' => __ ('The file name contains invalid characters.')));
return;
Expand Down

0 comments on commit fa716c9

Please sign in to comment.