You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This gem allows you to easily upload your medias on Dropbox using the awesome
CarrierWave gem.
Installation
First, you have to create a Dropbox app.
You can either create a "full dropbox" or "app folder" application. Please see
this wiki for
further information and gotchas.
Then, add this line to your application's Gemfile:
gem'carrierwave-dropbox'
Then run bundle to install the gem.
To make a Dropbox app and generate a token, go here.
Then, specify the token in your configuration (in an initializer for instance)
like this:
Note: It's advisable not to directly store the credentials in your files
especially if you are using a SCM (e.g. Git). You should rather rely on Rails'
secrets feature.
Then you can either specify in your uploader files the storage or define it
globally through CarrierWave.configure:
Unlike typical CarrierWave storage engines, we do not assume an uploaded file
will always be at the same path, as Dropbox UI users may move files around. As
such, this gem relies on the file id. There are two significant implications to
this approach:
The #store_path and #store_dir methods are not guaranteed to be accurate
after the initial file upload. We do not overwrite these methods as the end user
will often overwrite these methods to specify where the file should initially
be stored.
The default #filename method is not accurate, as we are storing the Dropbox
id, rather than the name of the file. It's recommended that end users overwrite
the #filename method to delegate to the CarrierWave::Storage::Dropbox::File
interface. For example:
classMyUploader < CarrierWave::Uploader::Basestorage:dropboxdeffilenameiforiginal_filename# Perform any file name manipulation on initial uploadelsiffilefile.filenameendendend