We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    It's a collision with another snippet, or you have two fileUpload() tags on the same page. If it's the latter, the fix is easy, but I should really refactor fileUpload to put that function in a class. Let me know which it is.

    Also, what snippet has the ID of 60? Is it the FileUpload snippet or something else (and if so what snippet is it)?

    I don't think that would be related to the upload limit or the upload location, but it's possible. Let me fix it and you can see.




    ------------------------------------------------------------------------------------------
    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
      • 13808
      • 61 Posts
      Sorry - that's info I could have provided before!

      There's only one tag in the page and and the Snippet with ID = 60 is FileUpload so it sounds like it's clashing with something else.

      That said, a quick database search:
      SELECT name FROM `modx_site_snippets` WHERE `snippet` LIKE '%setError%';
      Only turns up one result: FileUpload. Kind of a dead end.

      Anything else I can check for you?
        • 3749
        • 24,544 Posts
        Thanks. See what this does: change the name of that function in the snippet code to something unique (e.g., fu_setError) and change the name of all calls to it in the snippet.

        That will tell us of its conflicting with itself or code elsewhere.
          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
          • 13808
          • 61 Posts
          Replacing the function name didn't fix it.

          I've done some digging and got to the bottom of the issue. Turns out you were on to something when you mentioned the Snippet being called twice. The template I had the page in calls the content block twice (once in a cut-back form in the header for social media sharing tags and once in the 'normal' place in the page).

          When I sort that out so that it cuts MODX tags out, the upload form works with the setError function intact but still throws the oversize error despite me only uploading a 60kb file. Something is definitely broken at a deeper level here. Time to report in to the ISP I reckon.
            • 3749
            • 24,544 Posts
            Get the new version through Package Manager and install it. The function-name collision should be fixed at least.


            ------------------------------------------------------------------------------------------
            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
              • 13808
              • 61 Posts
              Thanks BobRay - right now I'm getting
              An error occurred while connecting to the Provider: Could not find package: fileupload
              Other random packages out of my list don't seem to be having the issue.
                • 3749
                • 24,544 Posts
                That's weird. I just tried it and it downloaded fine (though I didn't have any previous versions installed). Give it another try. If it doesn't work, you might try uninstalling and removing all older versions first (hopefully, you haven't modified the default objects).


                ------------------------------------------------------------------------------------------
                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
                  • 13808
                  • 61 Posts
                  OK - uninstalled, removed and grabbed again from scratch. Cleared the site cache too.

                  Now getting the following:
                  Fatal error: Using $this when not in object context in /[path]/includes/elements/modsnippet/62.include.cache.php on line 187
                  Snippet 62 is the FileUpload snippet but there's no $this at like 187.

                  Can't help but wonder what it means about the upload process and this server if I'm the only one having these issues.
                    • 3749
                    • 24,544 Posts
                    No, it's definitely not you. It's me. I did a bad job of integrating a new feature from another user. I should have it fixed soon (in the meantime, you can just edit the snippet and change all instances of $this->targetfile to $targetfile -- I think there are three).

                    Let me know if that works.


                    ------------------------------------------------------------------------------------------
                    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
                      • 13808
                      • 61 Posts
                      Yep - that fixed it and the form loads nicely. I was still having the issue with the upload limit being tripped though so I went back for another look at my settings.

                      I'd used a calculator on my desktop to calculate what 10mb was in bytes and then copied and pasted the answer into the 'Maximum upload size' field. The value was "10,485,760". The problem with that value? MODX is expecting a number of bytes and that value has commas in it!

                      I removed the commas from the value in the systems settings and everything is now completely fine! I can't put into words just how stupid I feel right (now nor how relieved I am that everything is working for that matter!)

                      Thanks for your time BobRay - I'm about to put your snippet to use within the site so this will all have been a helpful exercise both ways.