We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37032
    • 64 Posts
    Hi there,

    I need some help to sort out the assets folder. What I'm looking for is something like this:


    • Have a folder called "upload" in the root of the assets folder (/assets/upload/).
    • Customer should only be able to browse the contents of the "upload" folder and below.
    • Me (admin) should have access to all files from MODx root.

    I tried to set the "filemanager_path" for non admin users to "assets/upload". That work out pretty good. After that they could only see what I wanted and not the whole MODx directory. On the other hand I got problems with URLs. When the customer saved a resource the generated URL was e.g. "flower.png", nothing more. If I (admin) created same resource, the generated URL was "/assets/upload/flower.png".

    A few questions:


    • 1. Using "filemanager_path" is that the proper way to do it?
    • 2. If above is the right way to do it –how do I get the generated URL to be same for everyone?
    • 3. If 1 is not the proper way to do it, please help. smiley
    • 4. Can someone please explain for me like I was 5 years old what's the difference between "File Manager Path/URL & Resource Path/URL". I'm getting confused. smiley

    Help is appreciated!
    [ed. note: tomahl last edited this post 14 years, 10 months ago.]
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      Forgive me for jumping in where I might not really know what I'm talking about, but I think perhaps what is happening is supposed to happen. Since you've blocked access to all other directories except the upload directory, a user working within that environment wouldn't have access to any of the folder names other than the one they are allowed to access.

      The uri of the file the user uploads isn't different than what you're seeing as an admin, but the user is operating from the upload folder as if it's the root (their root) so they can't see anything but that in the properties.

      Now, my question to you is... What are you attempting to do with the files the users upload? How does the generated url matter to the users? Are you wanting them to modify resources (documents, pages...) and manually type in url's into html or will they be editing resources with TinyMCE? If files will remain in the upload folder, when the user clicks the insert image/file button, the path should resolve properly in the resource (page). Is this generated url within the editor the problem, or is it just that the users don't see the full path when viewing the properties of the file?

      The difference between the filemanager path and resource path is simply that the filemanager path is where the filemanager in MODx directs to when accessed by certain users. This is why you can lock the filemanger up like you have. The resource path remains what it is, the full path to the files. It's how you call it in the resources (pages) that makes the difference.

        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 37032
        • 64 Posts
        Thanks for answering Frogabog.

        My customer upload PDF-files, images, word-documents for their articles. I want those files to live in the "upload" folder in the root of the assets folder. When they browse files I want them to only see and have access to the contents of that "upload" folder. Why? Because I don't want them to accidentally mess with any of the other files outside their "upload" folder. Also they get a cleaner browser if they don't see all those files and folders.

        Problems is. When they choose an image for a resource. The HTML-output would be /flower.png but I need it to be /assets/upload/flower.png, otherwise it doesn't show.
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          Ahh... So, what I assumed should work, doesn't. I assumed incorrectly. Gotcha.


          Have you tried entering the physical path in the resource_path system setting for the user?

            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 37032
            • 64 Posts
            Not yet, gonna try that. Thanks.
              • 37032
              • 64 Posts
              Hm, that didn't work either. sad

              Currently I have this set for user:

              filemanager_path - /assets/upload/

              resource_path - /assets/upload/

              HTML-output is still the same, pointing from their root e.g. "flower.png"
                • 10208 ☆ A M B ☆
                • 1,780 Posts
                Try setting the resource url path specifically, and/or turn off rewrite browser path. That should result in an absolute url, which should work as well as a relative url.
                  Frogabog- MODX Websites in Portland Oregon
                  "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                  Having server issues? These guys have MODX Hosting perfected - SkyToaster
                  • 33983 ☆ A M B ☆
                  • 181 Posts
                  Try setting both the filemanager_path and the filemanager_url to the same values. Then clear cache and sessions and see if it works. This is what I have for 2.1.* and it works.
                    • 37032
                    • 64 Posts
                    It still does't work. Atm I've got following set under user setting, global system settings is untouched:

                    filemanager_path - /assets/upload/
                    filemanager_url - /assets/upload/
                    rb_base_dir - /assets/upload/
                    rb_base_url - /assets/upload/
                    strip_image_paths - No

                    I've also tried to set "strip_image_paths" to NO in global system settings.

                    Some progress:
                    Changing "filemanager_url" in global system settings to "/assets/upload/" does the trick for the customer/user. Unfortunately it doesn't play well with the Admin account. When I'm updating any resources with an image set, the first part of the URL containing "/assets/upload/" from system settings is generated twice e.g. /assets/upload/assets/upload/flower.png

                    What a mess..zZz.. Gonna sleep on it. smiley

                    Thanks for your help and suggestions.
                      • 33983 ☆ A M B ☆
                      • 181 Posts
                      Try removing the first "/" and just make them assets/uploads/ and make sure you have the <base> element in your templates.