Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

carrierwave-filepickerio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carrierwave-filepickerio

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

carrierwave-filepickerio

FilePicker.io support for CarrierWave.

Installation

Install the latest stable release:

gem install carrierwave-filepickerio

In Rails, add it to your Gemfile:

gem 'carrierwave-filepickerio'

Configuration

Add your FilePicker.io API key to the CarrierWave initializer:

CarrierWave.configure do |config|
  # ... add the following
  config.filepickerio_api_key = '[Your API key]'
end

Usage

After setting up your CarrierWave uploader as per normal (see the CarrierWave site for more information) you need to configure your page to use the Filepicker.io widget.

First of all, include the filepicker.io JavaScript library in your page (such as your application.html.erb layout):

<%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>

... or, if you're not using the asset pipeline, you can use the expansion:

<%= javascript_include_tag :filepickerio %>

Form Builders

To use the FilePicker.io uploader you need to call the view helper like so:

<%= form_for @entry do |f| %>
  <%= f.fp_file_field :image %>
  <%= f.fp_save_button :image, "Save existing image to cloud", 'image/jpeg' %>
<%- end %>

You can change the button text by passing along a string as the first parameter

<%= f.fp_file_field :image, "Pick a picture" %>

To include a drag-n-drop area pass the dragdrop parameter in the options hash, which is the last parameter.

<%= f.fp_file_field :image, "Pick a picture", dragdrop: true %>

You can also attach any other events to the input as normal, for instance you can listen to change events:

<%= f.fp_file_field :image, "Pick a picture", dragdrop: true, onchange: '$("#pic").attr("src", arguments[0].files[0].url)' %>

Specify any Filepicker.io additional data options in the data hash

<%= f.fp_file_field :image, "Pick a picture", data: { 'fp-mimetypes' => 'image/jpeg,image/png' } %>

You may include any of the additional parameters...

Additional Options

Any additional Filepicker.io configuration can be passed within an optional data hash passed to the view helper method.

<%= f.fp_file_field :image, data: { "fp-button-text" => "Pick a lolcat to upload" } %>

See https://developers.filepicker.io/docs/web/ for a full list of configuration options.

FAQs

Package last updated on 19 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc