I am looking for a way to allow only document types (.doc, .pdf, ...) to be uploaded to "document" subfolders and image types (.gif, .jpeg, ...) to be uploaded to "images" subfolders. In other words, I need something that acts like allowed/denied extensions in the accessControl structure. Is there some technique that I am missing that could accomplish this? I am using ColdFusion with application variables enabled.
Gregg
Gregg

Re: Allowed/Denied extensions for subfolders
Edit Core/FolderHandler.cfc and adjust checkSingleExtension function to your needs.
var i=1; var lcaseExt = lcase(ARGUMENTS.ext); //*** CUSTOM CODE START *** //check the extension depending on the location var folderPath = ""; var pathParts = ""; folderPath = APPLICATION.CreateCFC("Utils.Misc").TrimChar(THIS.clientPath, '/'); pathParts = listtoarray(folderPath, '/'); //loop through pathParts, if any element equals "images" and the extension is not "jpg", return false ... //*** CUSTOM CODE END *** //do the rest as ususal if (arrayLen(THIS.deniedExtensions)) { for(i=1;i lte arrayLen(THIS.deniedExtensions);i=i+1) { ...Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Allowed/Denied extensions for subfolders
Wiktor,
Thanks for the reply. I implemented your suggestion but am having an issue. When I try to upload a file that does not have a sub-folder specific allowed extension, a couple JavaScript errors are thrown. Here's the code chunk that I wiggled into checkSingleExtension:
//*** CUSTOM CODE START - WW/GJR*** //check the extension depending on the location var currentfolderPath = ""; var pathParts = arrayNew(1); //set specific allowed extensions for "images" and "documents" var ImagesExtList = "bmp,gif,jpeg,jpg,png"; var DocumentsExtList = "doc,pdf,txt,xls"; currentfolderPath = APPLICATION.CreateCFC("Utils.Misc").TrimChar(THIS.clientPath, '/'); pathParts = listtoarray(currentfolderPath, '/'); //loop through pathParts, if any element equals "images" and the extension is not "jpg", return false for(j=1;j lte arrayLen(pathParts);j=j+1) { if (pathParts[j] eq "images") { if (not ListFindNoCase(ImagesExtList, lcaseExt)) { return false; } } if (pathParts[j] eq "documents") { if (not ListFindNoCase(DocumentsExtList, lcaseExt)) { return false; } } } //*** CUSTOM CODE END ***Here's the content of the JS error messages:
Line: 50
Char: 498
Error: Object doesn't support this property or method
Code: 0
URL: http://.../fckeditor/ckfinder/ckfinder.html
Any help would be appreciated.
Gregg
Re: Allowed/Denied extensions for subfolders
Open ckfinder\core\js\ckfinder_ie.js
replace all occurences of
with
and clear browsers cache.
Let me know if that solved the problem.
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Allowed/Denied extensions for subfolders
Problem solved!
Thanks,
Gregg