mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-13 03:12:17 +02:00
Fix upload of existing files (#1026)
This commit is contained in:
parent
7ca87c9163
commit
00541fc469
|
@ -914,7 +914,6 @@ if (!empty($_FILES) && !FM_READONLY) {
|
||||||
echo json_encode($response); exit();
|
echo json_encode($response); exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$override_file_name = false;
|
|
||||||
$chunkIndex = $_POST['dzchunkindex'];
|
$chunkIndex = $_POST['dzchunkindex'];
|
||||||
$chunkTotal = $_POST['dztotalchunkcount'];
|
$chunkTotal = $_POST['dztotalchunkcount'];
|
||||||
$fullPathInput = fm_clean_path($_REQUEST['fullpath']);
|
$fullPathInput = fm_clean_path($_REQUEST['fullpath']);
|
||||||
|
@ -952,11 +951,6 @@ if (!empty($_FILES) && !FM_READONLY) {
|
||||||
$fullPath = $path . '/' . basename($fullPathInput);
|
$fullPath = $path . '/' . basename($fullPathInput);
|
||||||
$folder = substr($fullPath, 0, strrpos($fullPath, "/"));
|
$folder = substr($fullPath, 0, strrpos($fullPath, "/"));
|
||||||
|
|
||||||
if(file_exists ($fullPath) && !$override_file_name && !$chunks) {
|
|
||||||
$ext_1 = $ext ? '.'.$ext : '';
|
|
||||||
$fullPath = $path . '/' . basename($fullPathInput, $ext_1) .'_'. date('ymdHis'). $ext_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_dir($folder)) {
|
if (!is_dir($folder)) {
|
||||||
$old = umask(0);
|
$old = umask(0);
|
||||||
mkdir($folder, 0777, true);
|
mkdir($folder, 0777, true);
|
||||||
|
@ -1002,7 +996,13 @@ if (!empty($_FILES) && !FM_READONLY) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($chunkIndex == $chunkTotal - 1) {
|
if ($chunkIndex == $chunkTotal - 1) {
|
||||||
rename("{$fullPath}.part", $fullPath);
|
if (file_exists ($fullPath)) {
|
||||||
|
$ext_1 = $ext ? '.'.$ext : '';
|
||||||
|
$fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) .'_'. date('ymdHis'). $ext_1;
|
||||||
|
} else {
|
||||||
|
$fullPathTarget = $fullPath;
|
||||||
|
}
|
||||||
|
rename("{$fullPath}.part", $fullPathTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (move_uploaded_file($tmp_name, $fullPath)) {
|
} else if (move_uploaded_file($tmp_name, $fullPath)) {
|
||||||
|
|
Loading…
Reference in a new issue