CKFinder. Rename uploaded files

I am using ASP.NET version of CKFinder. I need to rename all uploaded files to names like: file1.jpg, file2.jpg, fileN.jpg.
It would be great to write my own custom logic on the server to manage uploaded files, but ckfinder is standalone dll library that i include to my project.
I cant figure out how to change config settings on client side in proper way. Is it possible?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Well, i figured out how to solve my problem. When you download CKFinder zip package from official server there is Visual Studio project with source code.
We need to find FileUploadCommandHandler.cs class, located in CKFinder.Connector.CommandHandlers namespace.
We need to find SendResponse(...) method. Then find sFileName variable. Here we can write our custom logic beside main logic, like so:

//custom logic
sFileName = Util.MyCustomRenameLogic(sFileName);
//other logic

Also we can analyze all code, it is pretty simple. For example, we can add our custom logic to rename files, folders, change images quality, make watermark prints and so on.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply