Search code examples
phpresponsive-filemanager

responsive filemanager upload above public


I'm trying to implement responsive filemanager in a secured environment where it's user have to login to access a file library. To make sure users only have access to the uploaded files when the login session is active I've placed the filemanagers uploadfolder above the public_html.

$config = array(
/*
|-------------------------------------------------------------------
| DON'T TOUCH (base url (only domain) of site).
|-------------------------------------------------------------------
| without final / (DON'T TOUCH)
*/
'base_url' => ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && ! in_array(strtolower($_SERVER['HTTPS']), array( 'off', 'no' ))) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'],

/*
|-------------------------------------------------------------------
| path from base_url to base of upload folder
|-------------------------------------------------------------------
| with start and final /
*/
'upload_dir' => '/../Uploads/content/',

/*
|--------------------------------------------------------------------
| relative path from filemanager folder to upload folder
|--------------------------------------------------------------------
| with final /
*/
'current_path' => '../../../../Uploads/content/',

/*
|--------------------------------------------------------------------
| relative path from filemanager folder to thumbs folder
|--------------------------------------------------------------------
|
| with final /
| DO NOT put inside upload folder
*/
'thumbs_base_path' => '../../../../Uploads/thumbs/',

When making use of the above configurations I keep getting the error below:

There is an error! The upload folder there isn't. Check your config.php file.

The structure of the application is as following:

-Uplevel from public

--httpdocs (public_html)

---myapplication

----admin

-----Libs

-------Filemanager directory

Please keep in mind that the uplevel contains a "uploads" directory which is the upload folder.

Is it even possible to have the upload folder above the public_html? I tried different paths, also to set server path as base_path but still no results.

Would be great if you could help me to figure this out.

Thanks


Solution

  • To go from Filemanager directory to Uplevel is 5 levels up.

    'upload_dir' => '../../../../../Uploads/content/',
    'current_path' => '../../../../../Uploads/content/',
    'thumbs_base_path' => '../../../../../Uploads/thumbs/',
    

    Be sure the content and thumbs folders are created in Uploads and have write permissions.

    Now when you dump the path to an image, the Uploads folder is not outside public_html but inside myapplication.. then the paths should be

    'upload_dir' => '../../../Uploads/content/',
    'current_path' => '../../../Uploads/content/',
    'thumbs_base_path' => '../../../Uploads/thumbs/',