{"id":21026499,"url":"https://github.com/nimblehq/filepicker-rails","last_synced_at":"2026-05-18T12:08:23.771Z","repository":{"id":93480532,"uuid":"127082942","full_name":"nimblehq/filepicker-rails","owner":"nimblehq","description":"Port filepicker-rails 2.1.0 to work on Rails 5","archived":false,"fork":false,"pushed_at":"2018-03-28T04:51:41.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-30T21:02:40.335Z","etag":null,"topics":["ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://github.com/filestack/filestack-rails/tree/v2.1.0","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimblehq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-28T04:17:26.000Z","updated_at":"2018-07-05T06:49:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"aac38e0c-ccbe-4a1c-a479-f1c60c87e45b","html_url":"https://github.com/nimblehq/filepicker-rails","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nimblehq/filepicker-rails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimblehq%2Ffilepicker-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimblehq%2Ffilepicker-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimblehq%2Ffilepicker-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimblehq%2Ffilepicker-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimblehq","download_url":"https://codeload.github.com/nimblehq/filepicker-rails/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimblehq%2Ffilepicker-rails/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33177356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby-on-rails"],"created_at":"2024-11-19T11:44:56.196Z","updated_at":"2026-05-18T12:08:23.739Z","avatar_url":"https://github.com/nimblehq.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filepicker::Rails\n[![RubyGems][gem_version_badge]][ruby_gems]\n[![Travis CI][travis_ci_badge]][travis_ci]\n[![Coveralls][coveralls_badge]][coveralls]\n[![Code Climate][code_climate_badge]][code_climate]\n\nAdds form, image_tag, and download/save helpers to help you get up and running with [filepicker.io](http://filepicker.io) in Rails.\n\n# Attention\n\nFor new Rails project, please use the new version of `filepicker-rails` (the name was changed to `filestack-rails`) at here https://github.com/filestack/filestack-rails\n\nThis repo is the fix only for `filepicker-rails 2.1.0` to work on Rails 5. The change is only like this https://github.com/emars/filepicker-rails/commit/bdd44b14a824659193c1a1ccaf37672faac0da67\n\nSo why do we need to change on this version, why not use `2.2.0`. The reason is on `2.2.0` they release 2 things important is `fix the Rails 5 issues` and `change the from filepicker-rails to filestack-rails` :boom: (Check at here https://github.com/filestack/filestack-rails/commit/4e9703893cbfa2c0985f58691ee5accd47df0ebf#diff-4ac32a78649ca5bdd8e0ba38b7006a1eR5)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'filepicker-rails', git: 'https://github.com/nimbl3/filepicker-rails', tag: 'v2.1.0-rails-5'\n```\n\nAnd then execute:\n\n    $ bundle\n\nAdd the filepicker.io javascript library to your layout:\n\n```erb\n\u003c%= filepicker_js_include_tag %\u003e\n```\n\nSet your API Key in `config/application.rb`:\n\n```ruby\nconfig.filepicker_rails.api_key = \"Your filepicker.io API Key\"\n```\n\n## Usage\n\n### First create a migration to add the field that will hold your filepicker.io URL\n\nRun the Rails migration generator from the command line:\n\n    $ rails g migration AddNameOfAttrForFilepickerUrlToUser\n\nThen add a column to the model's table of type :string:\n\n```ruby\nclass AddNameOfAttrForFilepickerUrlToUser \u003c ActiveRecord::Migration\n  def change\n    add_column :user, :filepicker_url, :string\n  end\nend\n```\n\n### Adding an upload field to your form:\n\n```erb\n\u003c%= form_for @user do |f| %\u003e\n  \u003cdiv\u003e\n    \u003c%= f.label :filepicker_url, \"Upload Your Avatar:\" %\u003e\n    \u003c%= f.filepicker_field :filepicker_url %\u003e \u003c!-- User#filepicker_url is a regular string column --\u003e\n  \u003c/div\u003e\n\n  \u003c%= f.submit %\u003e\n\u003c% end %\u003e\n```\nThe `filepicker_field` accepts a options parameter, [click here to see all the valid options](http://rubydoc.info/github/Ink/filepicker-rails/master/FilepickerRails/FormHelper:filepicker_field).\n\n### Displaying an image:\n\n```erb\n\u003c%= filepicker_image_tag @user.filepicker_url, w: 160, h: 160, fit: 'clip' %\u003e\n```\n\nThe `filepicker_image_tag` accepts a options parameter, [click here to see all the valid options](http://rubydoc.info/github/Ink/filepicker-rails/master/FilepickerRails/ApplicationHelper:filepicker_image_url).\n\n### Accessing FilePicker File with OnChange:\n\nJavascript code in the onchange field acts as a callback, which is\ncalled on upload completion. You can specify onchange either in the ERB\ntemplate (as shown below), or unobtrusively via jQuery's change event.\n\n```erb\n\u003c%= form_for @user do |f| %\u003e\n  \u003cdiv\u003e\n    \u003c%= f.label :filepicker_url, \"Upload Your Avatar:\" %\u003e\n    \u003c%= f.filepicker_field :filepicker_url, onchange: 'onPhotoUpload(event)' %\u003e\n  \u003c/div\u003e\n\n  \u003c%= f.submit %\u003e\n\u003c% end %\u003e\n```\n\nThe callback is called with a special 'event' variable. The variable has a fpfiles (or if not multiple, also fpfile) attribute with information about the files (jQuery users: look under event.originalEvent).\n\nExample fpfiles object:\n```javascript\n[{\n    url: 'https://...',\n    data: {\n        filename: 'filename.txt',\n        size: 100,\n        type: 'text/plain'\n    }\n},{\n    url: 'https://...',\n    data: {\n        filename: 'filename2.jpg',\n        size: 9000,\n        type: 'image/jpeg'\n    }\n}]\n```\n\n### Allowing the user to download a file (or upload it to any of the supported services)\n\n```erb\n\u003c%= filepicker_save_button \"Save\", @user.filepicker_url, \"image/jpg\" %\u003e\n```\n\nThe `filepicker_save_button` accepts a options parameter, [click here to see all the valid options](http://rubydoc.info/github/Ink/filepicker-rails/master/FilepickerRails/ApplicationHelper:filepicker_save_button).\n\n### CDN\n\nSet your CDN Path in `config/production.rb` ([CDN usage](https://developers.inkfilepicker.com/docs/cdn/)):\n\n```ruby\nconfig.filepicker_rails.cdn_host = \"Your CDN host name\"\n```\n\n### Policy\n\nTo use the [filepicker policies](https://developers.inkfilepicker.com/docs/security/) follow this instructions.\n\nSet your Secret Key in `config/application.rb`\n\n```ruby\nconfig.filepicker_rails.secret_key = \"Your filepicker.io Secret Key\"\n```\n\n#### Expiry time\n\nBy default the expiry time is 10 minutes. If you need to change the expiry time this should be an integer and it is expressed in seconds since the [Epoch](http://en.wikipedia.org/wiki/Unix_time).\n\nSo you can do something like that to set the expiry time to 5 minutes.\n\n```ruby\nconfig.filepicker_rails.expiry = -\u003e { (Time.zone.now + 5.minutes).to_i }\n```\n\nIf you need always the same url, a static expiry time, to do some cache. You can set a date starting of the Epoch.\n\n```ruby\n-\u003e { 100.years.since(Time.at(0)).to_i }\n```\n\nThe argument need to be a [callable](http://www.rubytapas.com/episodes/35-Callable).\n\n## Demo\n\nSee a simple demo app [repo](https://github.com/maxtilford/filepicker-rails-demo)\n\n## RDocs\n\nYou can view the Filepicker::Rails documentation in RDoc format here:\n\nhttp://rubydoc.info/github/Ink/filepicker-rails/master/frames\n\n## Versioning\n\nFilepicker::Rails follow the [Semantic Versioning](http://semver.org/).\n\n## Issues\n\nIf you have problems, please create a [Github Issue](https://github.com/Ink/filepicker-rails/issues).\n\n## Contributing\n\nPlease see [CONTRIBUTING.md](https://github.com/Ink/filepicker-rails/blob/master/CONTRIBUTING.md) for details.\n\n## Credits\n\nThank you to all the [contributors](https://github.com/Ink/filepicker-rails/graphs/contributors).\n\n[gem_version_badge]: https://badge.fury.io/rb/filepicker-rails.png\n[ruby_gems]: http://rubygems.org/gems/filepicker-rails\n[travis_ci]: http://travis-ci.org/Ink/filepicker-rails\n[travis_ci_badge]: https://travis-ci.org/Ink/filepicker-rails.svg?branch=master\n[code_climate]: https://codeclimate.com/github/Ink/filepicker-rails\n[code_climate_badge]: https://codeclimate.com/github/Ink/filepicker-rails.png\n[coveralls]: https://coveralls.io/r/Ink/filepicker-rails\n[coveralls_badge]: https://coveralls.io/repos/Ink/filepicker-rails/badge.png?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimblehq%2Ffilepicker-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimblehq%2Ffilepicker-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimblehq%2Ffilepicker-rails/lists"}