Uploading images outside of Perch CMS default resource directory
I have been building a site using the fabulous Perch CMS but discovered that the default upload path for images is inside the perch directory which caused my a bit of concern. Most Perch based sites I have looked at have been happy to use this but to be extra safe I like to change the name of the Perch directory which is easy to do in the config.php file.
define(‘PERCH_LOGINPATH’, ‘/admin’);
However any uploaded files go into the resources directory which is actually inside the Perch directory - thus revealing what you have renamed it. That wasn’t really how I wanted it so I contacted the Perch chaps - very helpful - to see if I could set a path for the uploads outside of the Perch directory.
What they suggested was changing two of the line in the Perch config.php file to include the full path to the directory file and the directory from the root of the site:
define(‘PERCH_RESFILEPATH’, PERCH_PATH . DIRECTORY_SEPARATOR . ‘/Volumes/Drobo/www.mysite,com/
development/20120508/assets/img/content’);
define(‘PERCH_RESPATH’, PERCH_LOGINPATH . ‘/assets/img/content’);
I set this all up as instructed but was getting errors in the control panel - Perch was appending the perch directory - /admin in my example above - on the beginning of the URL for the upload directory giving a path of /admin/assets/img/content- not what was wanted at all!
So I raised the issue with the Perch team again and they gave me some (apparently) undocumented advice to change the two file path lines in config.php to:
define(‘PERCH_RESFILEPATH’, ‘/Volumes/Drobo/www.mysite,com/
development/20120508/assets/img/content’);
define(‘PERCH_RESPATH’, ‘/assets/img/content’);
and that worked a treat!
Next short: Shorts are back
Previous short: Aperture tidy up


