We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9342
    • 50 Posts
    I'm trying to make my first Modx Revo with the membership login. What I want to achieve is

    1. allow user to create new resources,
    2. be able to edit their owns
    3. access to specific assets folders only (which relate to that resource only)

    - I use Newspublisher & Articles to get the 1st and 2nd jobs done.
    - I use FileUpload to allow user crate and upload images to the folder with the same id with resource.
    - I use FileLister to retrieve those files form the upload folder.

    One last thing is that I want the user to be able to delete the file that they uploaded in that folder (not someone else). How can I do this? I've tried to setup Media Source: Filesystem with

    basePath = assets/uploads/[[*id]]/ 


    but didn't work.
    [ed. note: fab last edited this post 11 years, 6 months ago.]
      • 9342
      • 50 Posts
      I try
      basePath = assets/uploads/89/
      where 89 is the folder name (which will be relate to the resource id 89), this works fine. I still can't figure it out that how can I retrieve resource id dynamically.
        • 3749
        • 24,544 Posts
        You might be able to create a user setting for each user (call it directory), then use one of these:

        basePath=`assets/uploads/[[++directory]]/`

        or
        basePath=`assets/uploads/{directory}/`


        I don't think it will work, but it's worth a try.

        Another option might be to create a user setting for default_media_source.


        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html
        [ed. note: BobRay last edited this post 11 years, 9 months ago.]
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 9342
          • 50 Posts
          Thank you Bob,

          I tried that but still no luck.

          My assumption is setting tags doesn't work here. when I change
          basePath= assets/uploads/89/

          to
          basePath= [[++assets_path]]uploads/89/

          I can't access to that folder any more.
            • 9342
            • 50 Posts
            I'm trying a new approach by following your instruction in the book page 225, but still can't get it right. Any suggestion?
              • 3749
              • 24,544 Posts
              @SELECT or @EVAL?

              What are you putting in the TV?


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 9342
                • 50 Posts
                Like I said, I'm new here. I don't know how to use @SELECT or @EVAL yet.

                I'm trying with @DIRECTORY

                1st Try
                Input Type = File or Image
                Input Option Values = @DIRECTORY assets/uploads/89/
                Output Type: Image

                Result: Not Good, Still see other folders.

                2nd Try
                Input Type = Radio Options or Listbox (single select)
                Input Option Values = @DIRECTORY assets/uploads/89/
                Output Type: Image

                Result: Better, can't see other folders but not practical if there are many choices.

                3rd Try
                Input Type = Radio Options or Listbox (single select)
                Input Option Values = @DIRECTORY assets/uploads/[[*id]]/
                Output Type: Image

                Result: Don't see any result at all sad

                  • 3749
                  • 24,544 Posts
                  Your second try is the only thing that will work, though you could use an output type of default or text and get a list of the filenames if that would be better.

                  It is possible to create a custom TV type, but it's not simple (and I've never tried it).

                  You might also take a look at the MigX package. Which might let you use @DIRECTORY in interesting ways.


                  ------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using.
                  MODX info for everyone: http://bobsguides.com/modx.html
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 9342
                    • 50 Posts
                    Thank you Bob. It's like you're working full time here, really appreciate your help.
                      • 3749
                      • 24,544 Posts
                      Sometimes it feels like it (except for the getting paid part). wink


                      ------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using.
                      MODX info for everyone: http://bobsguides.com/modx.html
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting