S
S
Stepan2015-02-17 12:20:27
MySQL
Stepan, 2015-02-17 12:20:27

How to get a list of files in a directory and rename one of them?

There are files in the directory, you need to make it possible for the user to re-upload them, but leave the old version.
To do this, I want to add something (file-name__old.jpg) to the old file, save a new file (file-name.jpg) and save the whole thing in the database.
But so far it's not even possible to get a list of all files from the directory

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Makarov, 2015-02-17
@SamDark

$files = FileHelper::findFiles($dir);
The rest means PHP.

R
Ruslan, 2015-02-17
@rutrader

The list of files can be obtained through RecursiveDirectoryIterator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question