Change the name of the uploaded file
Change the name of the uploaded file

Hello,
I use the file uploading function almost all of my projects.
I use the following code:
https://editor.datatables.net/examples/advanced/upload-many.html
Right now the filename is the ID of the file table, which is a AI INT. For example:
ID: 7
filename: pr-edp-1001.pdf
filesize: 1047119
web_path: /upload/7.pdf
system_path: /var/www/pr//upload/7.pdf
I would like to change this to contain the original filename.
I know that this has to be unique, so the web_path and system_path sould be the ID + '-' + original filename:
7-pr-edp-1001.pdf
How can I acieve this?
Thank you and best regards:
Endre, Szak
Answers
Hi Endre,
If you have a look at the PHP controller for that file it uses:
If you have a look at the documentation here you will be able to see that you can use
__NAME__
as well as__ID__
to achieve what you are looking for.Allan
Hi Allan,
Perfect, I use the
'/upload/__ID__.__NAME__'
format.It works like a charm.
Thank You and best regards:
Endre, Szak