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

    I would like to know if there is a functionality or an add-on allowing to store word documents, pdf, etc. in the DB instead of on a file system. Unfortunately, there is a front-end where I host the site which doesn't allow to secure a part of the website using htaccess. This front-end delivers the static content bypassing apache (NGNIX). I should either develop a functionaltiy on Modx or move to another hosting company. So, the question is, if there is a way to store documents in the DB instead of uploading them onto FS.

    Many thanks in advance!
      • 6228
      • 249 Posts
      You can store virtually any kind of data, including files, in a database. It is not necessarily the smartest approach at securing content, though.

      You can upload to a directory outside the web root, and then provide protected symlinks to those files to your site visitors. You could take it a step further and obfuscate the links and time-limit them so they expire after a certain amount of time.

      Granted this will take some PHP know-how, but there are plenty of PHP-based secure file downloading scripts on the 'net such as DLGuard and DisposableLinks (commercial products I cannot vouch for).

      Hope this helps
        lo9on.com

        MODx Evolution/Revolution | Remote Desktop Training | Development
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        http://dev.mysql.com/doc/refman/5.0/en/blob.html

        You would create a custom table, with a text field for the item's name and a BLOB field for the item. Links would actually be form submit buttons, and the file would be served from the database.

        http://www.webmasterworld.com/php/3498748.htm
        http://onlamp.com/pub/a/php/2000/09/15/php_mysql.html
          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
          • 780
          • 12 Posts
          Thank you all for your input! I'll take a look at both suggestions.