File Export (Save To) - Export a File to Cloud Service

When a user creates content in your application, generates a report, or finds something that they want to save for later, you can allow them to send that content directly to dropbox, google drive, evernote, or even send it via email.

The Filestack javascript library allows you to accomplish this easily with only a few lines of code.

Export is basically the opposite of filepicker.pick, in that it takes a Blob and lets the user specify where to send it to.

Syntax

<script src="https://api.filepicker.io/v1/filepicker.js"></script>
<script type="text/javascript">
  filepicker.setKey("your_API_KEY");
  filepicker.exportFile(input, picker_options, onSuccess(Blob){}, onError(FPError){}, onProgress(FPProgress){});
</script>

Example Export Code - Url file export

Launch export dialog using Filestack URL and suggested filename
filepicker.exportFile( 'https://www.filestackapi.com/api/file/qHi4LxRh28IeEBdJcFpw', { mimetype:'image/jpeg', suggestedFilename: 'newFile' }, function(Blob){ console.log(Blob.url); } );

Example Export Code - Blob file export

Launch export dialog using Filestack Blob with default filename
var blob = { url: 'https://www.filestackapi.com/api/file/AMltoa8ATECOsFTMduLz', filename: 'hello.txt', mimetype: 'text/plain', isWriteable: true, size: 100 }; filepicker.exportFile( blob, function(Blob){ console.log(Blob.url); } );
input
the file to export
input
string or blob
{Filestack Blob or URL}

A Blob or URL pointing to data you'd like to export. If you have a DOM File object or raw data, you can use the filepicker.store call to first generate a Blob

picker_options
An optional dictionary of key-value pairs that specify how the picker behaves.
Container
String
container: 'modal'

Where to load the Filestack UI into. Possible values are "window", "modal", or the id of an iframe in the current document. Defaults to "modal" for desktop browsers and 'window' for mobile browsers.

Mimetype
String
mimetype: 'image/png'

The mimetype of the file. Note that we try to guess the file extension of the file from this, so image/png will result in a .png ending while image/* will not have an ending. If you don't specify the mimetype, we will try to guess, otherwise we will fall back to letting the user save the file as whatever extension they choose, which may cause issues (if they try to save text to Facebook, for instance).

Extension
String
extension: '.pdf'

The extension of the content you want the user to save. Like mimetype, this is used to suggest a filename and prevent the file from being saved to services that don't support it (Sending text to Facebook, for instance). Do not use both extension and mimetype at the same time.

Filename
String
suggestedFilename: 'newFile'

Provide a recommended file name. The user will always be able to overwrite but you'll be able to set the default name.

Services
String
service: 'FACEBOOK'
services: ['FACEBOOK','BOX',…]

Specify which services are displayed on the left panel, and in which order, by name.

Be sure that the services you select are compatible with the mimetype(s) or extension(s) specified.

Currently, Filestack supports the following services, and we're adding more all the time:

  • BOX
  • COMPUTER
  • DROPBOX
  • EVERNOTE
  • FACEBOOK
  • FLICKR
  • FTP
  • GOOGLE_DRIVE
  • SKYDRIVE
  • PICASA
  • SEND_EMAIL
  • ALFRESCO
  • CLOUDDRIVE
  • IMGUR
  • CLOUDAPP
  • TWITTER
For all new applications, it is required to set your own Dropbox OAuth keys in order to use the Dropbox service with Filestack. More info

The COMPUTER service should be specified if you want users to be able to select files from their local device (their desktop or mobile device). To learn more about local file uploads Click Here

Default Service
String
openTo: 'BOX'

Specifies which service to show upon opening the picker dialog.

Language
String
language: 'es'

Specify the filestack dialog language version. If not set, it will use language detected in the browser. If the detected language is unavaliable, the default value is 'en'.

Supported languages:

  • Czech: 'cs'
  • German: 'de'
  • English: 'en'
  • Spanish: 'es'
  • Spanish (Mexican): 'es_mx'
  • Faroese: 'fo'
  • French: 'fr'
  • Canadian French: 'fr_ca'
  • Hebrew: 'he'
  • Italian: 'it'
  • Dutch: 'nl'
  • Danish: 'da'
  • Norwegian: 'no'
  • Polish: 'pl'
  • Portuguese: 'pt'
  • Portuguese (Brazilian): 'pt_br'
  • Russian: 'ru'
  • Swedish: 'sv'
  • Turkish: 'tr'
  • Chinese (Taiwan): 'zh_tw'
  • Greek: 'el'
  • Spanish (Argentina): 'es_ar'
  • Finnish: 'fi'
  • Indonesian: 'id'
  • Korean: 'ko'
  • Slovak: 'sk'
  • Ukrainian: 'uk'
  • Chinese: 'zh'
  • Serbian: 'sr'
  • Bulgarian: 'bg'
  • Malay: 'ms'
  • Hungarian: 'hu'
  • Vietnamese: 'vi'

If you would like to co-create the translation to any language, please contact us.

Mobile UI
Boolean
mobile: true

By default filepicker's v1 library opens the mobile UI on mobile devices. With 'mobile' set to true you can force the dialog box to open in mobile mode on desktops.

Security
Object
policy: POLICY, signature: SIGNATURE

If you have security enabled, you will need to include a valid Filestack policy and signature in order to perform the requested call. This allows you to select who can and cannot perform certain actions on your site. Read more about security and how to generate policies and signatures