简体   繁体   English

CKFinder。 重命名上传的文件

[英]CKFinder. Rename uploaded files

I am using ASP.NET version of CKFinder. 我正在使用ASP.NET版本的CKFinder。 I need to rename all uploaded files to names like: file1.jpg, file2.jpg, fileN.jpg. 我需要将所有上传的文件重命名为: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. 在服务器上编写自己的自定义逻辑来管理上传的文件将是很棒的,但是ckfinder是我包含在项目中的独立dll库。 I cant figure out how to change config settings on client side in proper way. 我无法弄清楚如何以正确的方式在客户端更改配置设置。 Is it possible? 可能吗?

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. 当您从官方服务器上下载CKFinder zip软件包时,就会有带有源代码的Visual Studio项目。 We need to find FileUploadCommandHandler.cs class, located in CKFinder.Connector.CommandHandlers namespace. 我们需要在CKFinder.Connector.CommandHandlers命名空间中找到FileUploadCommandHandler.cs类。 We need to find SendResponse(...) method. 我们需要找到SendResponse(...)方法。 Then find sFileName variable. 然后找到sFileName变量。 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. 例如,我们可以添加自定义逻辑来重命名文件,文件夹,更改图像质量,进行水印打印等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM