File Uploader - Use File Name? Solved

User's avatar
Aj H.
11:13 Jul 12, 2014
Hello, All -
I've been using File Uploader in a recent project - and it works really well. The only problem is that it always uses the same default text for the link: Download file.
I would like to change this to show the filename of the file as the link, eg: myDocument.pdf

I have looked at the code in the plugin which is easy to edit:
"+"Download file"+"

I have tried:
"+"{FILE}"+"

...but this includes the file path - so not perfect.
How can I insert just the filename?
Support team avatar
JS+
16:35 Jul 13, 2014
Hello,

Use templates for this: doksoft.com/soft/ckeditor-file-upload/customize.html
Now only {FILE} substitution is supported (it is full path), but in next version I will also add {NAME} too (only filename).

For example (simple link without image):
config.doksoft_file_template = '<a href='{FILE}'>Download file {FILE}</a>';

or (default template with the image):
config.doksoft_file_template =  "<div style='display:inline-block'>" +
  "<a class='doksoft_instant_file' href='{FILE}'>" +
   "<div style='display:inline-block'>" + 
     "<div style='background: url(\"{PLUGIN_PATH}download.png\") no-repeat; width:24px;height:24px;display:inline-block;'> </div>" +
	"<div style='font-size:16px;margin-left: 8px; padding: 0;display:inline-block;vertical-align:middle'>" +
	  "Download file {FILE}" +
        "</div>" +
       "</div>" + 
     "</a>" +
"</div>;
Support team avatar
JS+
18:40 Jul 15, 2014
OK, we have published an update today. I have send you an update where you can use {FILENAME} snippet.
User's avatar
Aj H.
19:41 Jul 15, 2014
Thanks. Excellent news!