Carrierwave uploads on Dropbox
This gem allows you to easily upload your medias on Dropbox using the awesome CarrierWave gem.
Then, add this line to your application's Gemfile:
And make sure that it gets installed running the
bundle command. Then, you have
to run the
rake dropbox:authorize command to authorize your application to access to
If you are using Rails, the Rake task is automatically loaded. Otherwise, if you
aren't running a Rails application, first load the task in your
Then you have to run this task:
rake dropbox:authorize APP_KEY=app_key APP_SECRET=app_secret ACCESS_TYPE=dropbox|app_folder
This command will output an URL ; use your browser to hit this URL and authorize your application. After that, return to the console and validate typing "y". Finally, you will get your credentials. Config CarrierWave to make it work with your Dropbox application:
CarrierWave.configure do |config| config.dropbox_app_key = ENV["APP_KEY"] config.dropbox_app_secret = ENV["APP_SECRET"] config.dropbox_access_token = ENV["ACCESS_TOKEN"] config.dropbox_access_token_secret = ENV["ACCESS_TOKEN_SECRET"] config.dropbox_user_id = ENV["USER_ID"] config.dropbox_access_type = "dropbox" end
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 store these values in environment variables for instance like in the above example.
Then you can either specify in your uploader files the storage or define it
class ImageUploader < CarrierWave::Uploader::Base storage :dropbox end
This project is highly based on these two gems:
Thanks to their respective authors and contributors!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
Please see the
LICENSE file for further information.