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

    I'm working on a website with modx Revo that will allow hundreds of end users to create and update their pages from the fronted. So far, I'm using Newspublisher to handle new posts from the frontend. However after searching everywhere, I could not find the solution that will allow end user to be able to add and delete their own images without access to the filesystem in manager.

    Recently, I found http://modx.com/extras/package/simplefileuploadtv, which allow user to upload files without dealing with the file system directly. However, this works only in the manager. What I'm trying to achieve here is to bring this feature to work with Newspublisher, so the users can uploads their files from the frontend without accessing to the file system.

    I think I almost get it right (trying to change how Newspublisher handle the image browser or files upload), but still stuck - don't know how things work. Anyone can help me with this.

    Thank you [ed. note: smashingred last edited this post 12 years, 2 months ago.]
      • 3749
      • 24,544 Posts
      I'm not familiar with that snippet and I'm not sure what it would take to get it working (and no time to mess with it now). You might try the FileUpload snippet below the NewsPublisher tag as an alternative.

      I think users can also upload files in NewsPublisher with a File 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
        Hi Bob,

        I'm using FileUpload right now, but the problem is that first users create the new page with NP which links to Article, then this will bring them to the new page that just created. From there, they can upload images using FileUpload, then return NP in order to sort or arrange order. Quite a long steps IMHO.

        After I mess around with the code in NP, I can assign a new case 'easyupload' (apart from image/upload), which is used by this plugin. However in the front end of NP, I can't manage to change the settings of path when user click to choose image, to be as similar as when they choose file to upload. I don't know if this all make any senses?

          • 3749
          • 24,544 Posts
          My wild guess is that the paths are set with JavaScript and that either the JS is not loaded, or there's a JS conflict.


          ------------------------------------------------------------------------------------------
          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
            Hi Bob,

            I managed to work around this by using FileUpload within an iframe and assign the media source to user.name folder. By doing so, the user can select the image from the TV at the same time when they crate a new Article.

            This seems to work fine until when I test this in IE8. When click on "Select an image" on the NP page, there is no new window popup. After I search for the problem, I found out that in the NP chunk "npImageTpl" there is one point needs to be changed.

            original
            <button type="button" onclick="var popup=window.open('[[+npx.browserUrl]]', 'Select image...', 'width=' + Math.min(screen.availWidth,1000) + ',height=' + Math.min(screen.availHeight*0.9,700) + 'status=no,location=no,toolbar=no,menubar=no');popup.focus();browserPathInput=getElementById('np-[[+npx.fieldName]]');">[[%np_launch_image_browser]]</button>


            change to

            <button type="button" onclick="var popup=window.open('[[+npx.browserUrl]]', 'Select', 'width=' + Math.min(screen.availWidth,1000) + ',height=' + Math.min(screen.availHeight*0.9,700) + 'status=no,location=no,toolbar=no,menubar=no');popup.focus();browserPathInput=getElementById('np-[[+npx.fieldName]]');">[[%np_launch_image_browser]]</button>


            This solution solved the problem as MSWindows does not allow space in the window name.

            However, when I select the image in the new window and click OK, there is nothing happen. The error log says " 'window.opner.browserPathInput' is null or not an object ". Do you have any idea about this issue?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That looks like a typo in some code somewhere; shouldn't that be window.opener.browserPathInput?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 9342
                • 50 Posts
                Hi Susan,

                It was my mistype since I can't copy the error and pasted here, so I just typed it.
                  • 15362
                  • 22 Posts
                  Any updates on this?

                  Newspublisher with simple file upload will be a great idea smiley

                  Thanks
                    • 3749
                    • 24,544 Posts
                    Not that I know of. NewsPublisher does allow users to upload files using a File or Image TV, though.
                      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