Search code examples
phproxy-fileman

Specific folder based on ID in RoxyFile file browser


Is it possible to set the upload folder based on the customer ID?

Example: Customer got the ID: 2543 ( stored in a session )

Config:

{
"FILES_ROOT":          "fileman/uploads/2543 ", // "fileman/uploads/CUSTOMERID "
"RETURN_URL_PREFIX":   "http://localhost/",
"SESSION_PATH_KEY":    "",
"THUMBS_VIEW_WIDTH":   "140",
"THUMBS_VIEW_HEIGHT":  "120",
"PREVIEW_THUMB_WIDTH": "100",
"PREVIEW_THUMB_HEIGHT":"100",
"MAX_IMAGE_WIDTH":     "1000",
"MAX_IMAGE_HEIGHT":    "1000",
"INTEGRATION":         "tinymce4",
"DIRLIST":             "php/dirtree.php",
"CREATEDIR":           "",
"DELETEDIR":           "",
"MOVEDIR":             "php/movedir.php",
"COPYDIR":             "php/copydir.php",
"RENAMEDIR":           "",
"FILESLIST":           "php/fileslist.php",
"UPLOAD":              "php/upload.php",
"DOWNLOAD":            "php/download.php",
"DOWNLOADDIR":         "php/downloaddir.php",
"DELETEFILE":          "php/deletefile.php",
"MOVEFILE":            "php/movefile.php",
"COPYFILE":            "php/copyfile.php",
"RENAMEFILE":          "php/renamefile.php",
"GENERATETHUMB":       "php/thumb.php",
"DEFAULTVIEW":         "list",
"FORBIDDEN_UPLOADS":   "zip js jsp jsb mhtml mht xhtml xht php phtml php3 php4 php5 phps shtml jhtml pl sh py cgi exe application gadget hta cpl msc jar vb jse ws wsf wsc wsh ps1 ps2 psc1 psc2 msh msh1 msh2 inf reg scf msp scr dll msi vbs bat com pif cmd vxd cpl htpasswd htaccess csv json php css html exe",
"ALLOWED_UPLOADS":     "",
"FILEPERMISSIONS":     "0644",
"DIRPERMISSIONS":      "0755",
"LANG":                "auto",
"DATEFORMAT":          "dd/MM/yyyy HH:mm",
"OPEN_LAST_DIR":       "yes"
}

Only the customer with the right customerID can see his folder. So nobody can touch other members folder.

I searched the web about it and could not find any solutions.


Solution

  • You need to modify your config file and change the following line:

    "SESSION_PATH_KEY": "roxyFilePath"
    

    Then you need to set this session variable before invoking Roxy filemanager. With PHP it could be set to correct value using user ID with

    $_SESSION["roxyFilePath"] = "Uploads/user/2543"
    

    You may also find useful to read this SO question as well PHP- RoxyFileMan set FILES_ROOT path dynamically