Fileinbox Articles & Guides

Dynamic subfolders

If you'd like your uploaders' files organized by a piece of information you already know about them - like their name or email address - you can set up the DBinbox uploader to pull off a piece of information from your website and use that as the folder name.

All you need to do is append the email to the URL of the link, like this:

<a href="https://dbinbox.com/cgenco/steve@apple.com" class="dbinbox">Upload Files through dbinbox.com</a><script type="text/javascript" src="https://dbinbox.com/embed.js"></script>

There are a few ways you can automatically accomplish this, but which one is easiest depends on how you're currently storing your uploader's email addresses. A good fallback would be to pull the email address from somewhere else on the page. Say somewhere else on the page you have the user's email address displayed in a span with an id of "email":

<span id="email">steve@apple.com</span>

You could dynamically pull the email address from this span and append it to your dbinbox embed link like this:

    <a href="https://dbinbox.com/cgenco/" class="dbinbox" id="dbinbox">Upload Files through dbinbox.com</a>
    <script type="text/javascript">
      var email = document.getElementById("email").text;
      var dbinbox = document.getElementById("dbinbox");
      dbinbox.href += email;
    </script>
    <script type="text/javascript" src="https://dbinbox.com/embed.js"></script>