Skip to content Skip to navigation

Using Box to House Online Documents

One of the needs that we frequently encounter on campus while building sites is linking to forms and documents like pdfs from within text areas like the body field in Drupal. Note: I've updated this blog post to reflect the newest version of Box as of 9/24/2014.

The Old Way

The old way to link to documents was through Drupal's file system.  One approach might be:

  1. Create a content type Uploaded Document with a file upload field.
  2. Add content by uploading files one by one into the Uploaded Document content type.
  3. Copy links from the saved Uploaded Document nodes into your WYSIWYG.

The above solution has a handful of drawbacks:

  • groups all uploaded documents into a single folder within your Drupal file system
  • makes duplicate documents in your files if you upload a revision 
  • changes URL when you upload a revision
  • cannot bulk upload files unless you have server access

The BOX Way

A new approach that we're beginning to use on sites is to use Box to house all of the documents that we want to link to!  Some content/images have been borrowed from this post on making direct download links in Box's documentation.

The process is:

  1. Add document to any folder in Box.
  2. In Box's online interface at, find the document.
  3. Use the down arrow menu on the far right to choose Share. This will give you the advanced Share options.
  4. Change file Access in the pop-up window to 'Anyone with a link.'  See 2nd image below.
  5. On the pop-up window select the address shown beneath the 'Direct Link' field. This link will include the file extension. See 3rd image below.
  6. Paste this link into Drupal. 

Here is an example:  This image is in one of my Box folders.



The Benefits

Compared to Drupal's default file storage, Box is a much better at digital asset management.  Using Box to manage your documents for web has the following benefits:

  • documents are readily accessible for editing by those with edit permissions
  • revised documents retain the same URL
  • Box automatically stores revisions of your documents
  • bulk uploads of documents into a folder is no problem
  • more sensitive documents can require Box login to view
  • documents can be organized into subdirectories for easy tracking
  • documents won't impact your AFS storage limit

What you need to know

If your website is for a department, be sure you link Box to your Stanford Workgroup so the quota is counted towards the department rather than your individual account. Also, the account will need to be configured to post public documents.  To do that:

  1. In Box click on the gear icon in the top right and choose 'Account Settings'
  2. Click 'Content & Sharing' tab
  3. 'Enable external links to:' 'Folders and files'
  4. '...with access options:' 'Open, Company, and Collaborators Only'


I've received some questions about the differences between Box and Google Drive. Check out this link for more information:

You can create a custom link for the document as well. In the folder for the document on the web interface for Box.

1) In line with the document title, click "More options"
2) Click "Share"
3) Click "Open Access" at the top of the pop up.
4) Click "Custom Link" and set the link.

As a best practice, be sure to use a title that includes your organization's name.

I recently had a request for an alternative to Box, as government collaborators cannot access Dropbox, Box, etc. You can consider using Stanford AFS. A full description is available here:

To add files for the web:

  1. Log into AFS with your SUNet ID at
  2. Click on "WWW" directory and choose the sidebar item "Upload File(s)" to add files that are visible without SUNet login.

The link to the file(s) will be:

There are a lot of additional options for changing permissions to specific files and creating group spaces. For more information, see:

Hi all, I recently had a question emailed to me asking about whether or not hosting images in Box for a website was a good idea. He found that they loaded very slowly. The answer is: don't host your website's images on Box or you'll have really slow loading images. It's better to use image fields and image insert for your site's images. Cheers!