mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #138] prevent overwriting if uploaded file already exists #101
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#101
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @crispyduck00 on GitHub (Mar 12, 2019).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/138
When a file is uploaded which name already exists, the existing file is overwritten without any warning.
To prevent overwriting existing files a (n) can be added to the filename of the newly uplodad file. Where n is a ongoing number starting with 0.
So for example if "file.zip" exists already in the upload path, rename the newly uploaded "file.zip" to "file (0).zip". If again the same filename is uploaded, rename it to "file (1).zip and so on.
This could be easylie archifed by adding following code bevore the "move_upload_file()" function:
regards,
crispyduck
@prasathmani commented on GitHub (Mar 13, 2019):
@crispyduck00 , added your suggestion. check with latest.
@crispyduck00 commented on GitHub (Mar 13, 2019):
@prasathmani , great solution simply adding the date!
Maybe $datetime_format without dot and spaces can be used for it.
What happens if the filename length exceeds the filesystem limit?
Maybe there should be a configurable filename limit for uploads:
like this
Thanks!
@hedwiggggg commented on GitHub (Mar 14, 2019):
It would be nice, if this feature is configurable; So we can turn it off and it actually overwrites the files.