3

In CiviCRM 4.6.5, I'm not able to upload files with CKEditor.

I get the very informative error Unknown error

It's seems to be a permission or problem like that when copying the file but without more information, it's difficult to find what it is.

I have found the forum post https://forum.civicrm.org/index.php?topic=26908.0 but my problem is not one of those described.

  • i'm having the same problem in one of my installations, i'm able to upload, rename and delete files in my local installation but not in production. Can it be https issue? My local is http and production is https – Kboy Dec 7 '15 at 16:04
  • A little bit late, but very many thanks for this solution. Ik took me 2 days of searching and I found the answer here! Great, I'am happy! – Aadv Jul 2 '18 at 10:36
4

After digging, i have found that the problem was in the function packages/kcfinder/core/class/uploader.php :: checkFilePath

This function forbids an upload if you have a symbolic link in your path.

There is also a related issue in CiviCRM JIRA : https://issues.civicrm.org/jira/browse/CRM-15607

EDIT:

Probably not a very good solution but you can patch kcfinder.

In my case it's complicated to remove the symbolic link so I used this as a temporary fix.

Add the following line as the first line of the function checkFilePath to avoid the verification:

     protected function checkFilePath($file) {
+        return True;
         $rPath = realpath($file);
         if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN")
             $rPath = str_replace("\\", "/", $rPath);
         return (substr($rPath, 0, strlen($this->typeDir)) === $this->typeDir);
    }
  • Thanks, this fixed my problem too. I guess it opens up a security hole in that up-loaders could potentially create symlinks to system files. Then again, we only have a couple of CiviCRM admins so should be a small attack surface. – FGiorlando Jul 13 '16 at 7:02
1

I had the same case,

the "clean" solution was to set an absolute path to Image Directory and the corresponding absolute URL to Image Upload URL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.