We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9439
    • 90 Posts
    I have the following setup:


    • Users register through login/register
    • Through a plugin, each user is given a resource and a user group that are exclusive, ie no user can edit anyone else's resource
    • A set of common TVs (all text, one image) are available for each user group's resource (resources are identical)
    • Users can login, edit their resource through Newspublisher, and logout
    • Anyone can view the resources on the website (they're made visible through a combo of wayfinder and getresources)

    The problem is the image TV. How do I enable users to upload images without everyone getting access to everyone else's images (and perhaps deleting them) and the entire file tree? If I restrict directory view to one folder for all images, it still means that all images are available to everyone. The only thing I could think of was to give each user their own directory when they register but I don't know, programatically, how to use media resources to create a corresponding media resource and add the user's user group to it (a bit beyond my programming pay grade).

    Seems too complicated though, the kind of scenario where there's a much simpler solution out there but I can't see it. Really I just want each user to be able to upload an image to their resource and not let anyone else have access to it.

    Right now, the solution I have is to change the TV to text and type the URL of an image held somewhere else - bit of a lame solution I think you'll agree.

    Any ideas anyone?

      David Heriot
      pfsmedia
      • 9439
      • 90 Posts
      Just found FileUpload. Simple and straightforward. Might do the trick. Even better if I can integrate with Newspub.
        David Heriot
        pfsmedia
        • 9439
        • 90 Posts
        Didn't use FileUpload in the end. Instead, I created a single images directory which holds uploaded images. If users want to use a new image, they just upload a new one. There's no browsing allowed of the images folder, which means that there's no security issues.

        Upload is a combination of using an iframe within a form then a little javascript to copy the name of the uploaded image into the main form's Image Name field.
          David Heriot
          pfsmedia