Search code examples
pyrocms

PyroCMS get the real filesystem path of a uploaded file


How do I get the "real path" (server path) of a file uploaded to the PyroCMS files module. I need to get the absolute path such as;

"c:\www\pyro\uploads\MYSITE_REF\real_file_name.xlsx"


Solution

  • For this you can simply define a constant like this in constant.php

    define('CUSTOM_FILE_PATH',FCPATH.'/uploads/'.SITE_REF.'/files/');
    

    Than you can call it anywhere

    $local_file = CUSTOM_FILE_PATH. $my_file_name;