We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    I guess that’s a trivial thing to do for most php savvy people here but I have both the FileDownload and FileUpload snippet on one page and when I upload a file, I need to manually reload the page to see the new file in the file list.

    I don’t think it’s a cache issue, FileDownload is called uncached and the page is uncached.

    My idea was, when FileUpload is used along with FileDownload, could there be a "refresh" or "reload" parameter to force the page to reload ?
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 6726
      • 7,075 Posts
      Any idea ?
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 19726
        • 239 Posts
        You can add a redirect to the current page when the file has been succesfully uploaded. But this means that you will lose your "upload succesfull" message. On my personal site I just put the upload snippet before the snippet that generates the directory listing and that works just fine without any adjustments.

        I you wanna add the redirect add teh following line to the snippet at around line 208. In also posted the before and after line so you can more easily find the correct place. So only the middle line needs to be inserted

                // Moved the uploaded file to the upload folder
                $modx->sendRedirect($modx->makeUrl($modx->documentObject['id'])); // ADD THIS LINE
                $fileoutput = $_fu_lang['uploaded'];
        
          • 10487 MODX Staff
          • 1,535 Posts
          You could maybe adjust the $modx->makeUrl() call to add a querystring parameter to then trigger some sort of an ’upload successful’ message. Just a thought smiley
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 6726
            • 7,075 Posts
            Thanks guys grin I’ll try this ASAP !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id