Answer the question
In order to leave comments, you need to log in
What are the ways to delete a file from the server?
I am writing an admin. There is a function for uploading files.
I upload a file, write it to the database (name, size, id, src) I
use the id of the file where necessary
. To delete a file, I find it by id and delete it from the database, but not physically.
After some time, there will be more physical files on the disk than in the database.
Am I right in thinking that you need to write a script that will go through the files in the \uploads folder and compare the physical file name and the file name that is in the database, if the name does not match, then delete the file physically. Run this script once a day for example?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question