Dumpbin

Dumpbin

Dumpbin saves files to and gets files from Dropbox.

Docs

Settings always display the default value. They also indicate the recommended usage, config file (key: default_value) or tag parameter (parameter="default_value").

You can edit the code within <pre>s on this page before copying and pasting.

Features

  • Dumpbin enables users to
    • choose files from their Dropboxes and
    • save files to their Dropboxes.
  • Dumpbin enables you to save chosen files from a user’s Dropbox to your site.

Dumpbin does not sync files with Dropbox.

Installation

Upload the dumpbin folder to _add-ons and follow the setup directions below.

Setup

Setup requires only that you obtain an app key for use in {{ dumpbin:js }}, which makes the buttons work. Obtain it like so:

  1. Visit the Dropbox developer site.
  2. Choose Drop-ins app.
  3. Enter the name of your site as the app name.
  4. Click create app.
  5. Input your site’s URL*.

*If you use this on a local site, you can use localhost or do something like the following:

  1. Set your local site to run at localhost.real-domain.com and
  2. input real-domain.com

{{ dumpbin:button }}

{{ dumpbin:button }} outputs a Dropbox Chooser input (which functions like a button) or Saver button.

Required Settings

type
type=""

Which should this generate, a chooser or a saver?

A chooser input lets users choose a file from their Dropbox account.

<form method="POST">
  {{ dumpbin:button type="chooser" }}
  <button type="submit">Submit</button>
</form>

A saver button allows them to upload a file to their account.

{{ dumpbin:button
    type = "saver"
    href = "http://curtisblackwell.com/assets/img/demos/thin-white-duke.jpg"
}}
href
href=""

You must set href only when type="saver".

href designates which file to upload.

This works only with publicly-accessible files.

Optional Settings for a Chooser

name
name: dumpbin_file

Use name to customize the name of the generated input (and therefore the POST variable).

link_type
link_type="direct"

direct links point directly to the file.

preview links point to a styled preview page.

multiselect
multiselect: false

If set to true, users can select multiple files.

extensions
extensions=""

The extensions parameter allows you to limit the filetypes users may select.

Valid Values

You can set extensions to a pipe-separated (|) list of file extensions or one of the following:

.bmp, .cr2, .gif, .ico, .ithmb, .jpeg, .jpg, .nef, .png, .raw, .svg, .tif, .tiff, .wbmp, .webp
.csv, .doc, .dochtml, .docm, .docx, .docxml, .dot, .dothtml, .dotm, .dotx, .eps, .fdf, .key, .keynote, .kth, .mpd, .mpp, .mpt, .mpx, .nmbtemplate, .numbers, .odc, .odg, .odp, .ods, .odt, .pages, .pdf, .pdfxml, .pot, .pothtml, .potm, .potx, .ppa, .ppam, .pps, .ppsm, .ppsx, .ppt, .ppthtml, .pptm, .pptx, .pptxml, .prn, .ps, .pwz, .rtf, .template, .tsv, .txt, .vdx, .vsd, .vss, .vst, .vsx, .vtx, .wbk, .wiz, .wpd, .wps, .xdf, .xdp, .xlam, .xll, .xlr, .xls, .xlsb, .xlsm, .xlsx, .xltm, .xltx, .xps
.applescript, .as, .as3, .c, .cc, .clisp, .coffee, .cpp, .cs, .css, .csv, .cxx, .def, .diff, .erl, .fountain, .ft, .h, .hpp, .htm, .html, .hxx, .inc, .ini, .java, .js, .json, .less, .log, .lua, .m, .markdown, .mat, .md, .mdown, .mkdn, .mm, .mustache, .mxml, .patch, .php, .phtml, .pl, .plist, .properties, .py, .rb, .sass, .scss, .sh, .shtml, .sql, .taskpaper, .tex, .text, .tmpl, .tsv, .txt, .url, .vb, .xhtml, .xml, .yaml, .yml, and files with no extension
.aac, .aif, .aifc, .aiff, .au, .flac, .m4a, .m4b, .m4p, .m4r, .mid, .mp3, .oga, .ogg, .opus, .ra, .ram, .spx, .wav, .wma
.3g2, .3gp, .3gpp, .3gpp2, .asf, .avi, .dv, .dvi, .flv, .m2t, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .mts, .ogv, .ogx, .rm, .rmvb, .ts, .vob, .webm, .wmv
{{ dumpbin:button
    type       = "chooser"
    extensions = ".pdf|.doc|.docx"
}}

Optional Settings for a Saver

class
class=""

What class(es) should Dumpbin apply to the button? Delimit multiple values with pipes (|).

filename
filename=""

Filename sets the name of the file to save to the user’s Dropbox. When not set, Dumpbin uses the original filename.

{{ dumpbin:save }}

{{ dumpbin:save }} saves a copy of a given file on your server.

Optional Settings

name
name: dumpbin-file

Set name to the name of the POST variable containing the URL to the file you want to save. This should match name in {{ dumpbin:button type="chooser" }}.

to
to=""

If you have a specific path where you want to save the file, set it here, relative to root. By default, Dumpbin saves files to root.

filenames
filenames=""

Set the names of the new files with filenames. The filenames default to those of the original files. Delimit filenames with pipes (|).

{{ dumpbin:save
    to        = "assets/user-uploads/"
    filenames = "one.jpg|two.jpg"
}}

{{ dumpbin:js }}

{{ dumpbin:js }} outputs a JavaScript tag that loads the necessary code from Dropbox.

You must use this tag in order for Dumpbin to function.

Required Settings

app_key
app_key:

The app key connects to a specific Dropbox account, so if you use this for a client, you have to use their account to get an app key. See setup for instructions on acquiring an app key.

 {{ dumpbin:js app_key="XXXXXXXXXXXXXXX" }}

Support

For now, support requests should be emailed to helpme@curtisblackwell.com.

I have plans to use a forum (or something similar) in the near future, however I’m waiting to see what Statamic offers, if anything, when the Trading Post launches.

Feature Requests

Feature requests are encouraged and should be emailed to ihaveagreatidea@curtisblackwell.com.