0

I'm using file browser with CKFinder. But I have a problem. During uploading filename is not saving Turkish format.

I want to load the file by changing the name. Can any Replace method be applied?

For example; File name: türkçe karakter sıkıntısı.jpg, Modified name: turkce-karakter-sikintisi.jpg

Thank you. Good luck with.

buræquete
  • 14,226
  • 4
  • 44
  • 89
  • You mean you cannot use `türkçe karakter sıkıntısı.jpg` and you want CKFinder to replace the name as `turkce-karakter-sikintisi.jpg`? – user2316116 Jan 12 '17 at 11:22
  • Yeah. As I mentioned above, I need to replace the name of the loaded image. But it is not the CKFinder Rename feature. This process will be automatic, actually the file name like SEO link. Thank you. – Avni Babaoğlu Jan 12 '17 at 11:34

1 Answers1

0

Read CKFinder. Rename uploaded files.

i.e. you need to update FileUploadCommandHandler.cs where you can modify sFileName in a way you like. To remove accent characters you can use code from How do I remove diacritics (accents) from a string in .NET?, to replace spaces you can use simple replace()

Example:

sFileName = System.IO.Path.GetFileName( oFile.FileName );
if ( Connector.CheckFileName( sFileName ) && !Config.Current.CheckIsHiddenFile( sFileName ) )
{
     //custom logic
     sFileName = RemoveDiacritics(sFileName).Replace(" ", "-");
     //other logic

     // Replace dots in the name with underscores (only one dot can be there... security issue).
     ...
Community
  • 1
  • 1
user2316116
  • 6,726
  • 1
  • 21
  • 35