File Attachment toolkit for Ruby applications
Alternatives To Shrine
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Uppy27,34555159a day ago100July 13, 2023164mitJavaScript
The next open source file uploader for web browsers :dog:
Filepond13,969173152a month ago199May 31, 202297mitJavaScript
🌊 A flexible and fun JavaScript file upload library
Elfinder4,48249476a month ago70June 13, 20239otherJavaScript
📁 Open-source file manager for web, written in JavaScript using jQuery and jQuery UI
16 days ago159gpl-3.0PHP
Single-file PHP file manager, browser and manage your files efficiently and easily with tinyfilemanager
Angular File Upload3,457279274 months ago25August 20, 2020247mitJavaScript
[ALMOST NOT MAINTAINED] Angular File Upload is a module for the AngularJS framework
Shrine3,0952555214 days ago53June 14, 202111mitRuby
File Attachment toolkit for Ruby applications
Vue Image Crop Upload1,98010367a year ago49April 09, 2021119JavaScript
A beautiful vue component for image cropping and uploading. (vue图片剪裁上传组件)
Ng2 File Upload1,8971,3114492 months ago24July 21, 2023421mitTypeScript
Easy to use Angular components for files upload
Express Fileupload1,4633,0567476 days ago45May 24, 202227mitJavaScript
Simple express file upload middleware that wraps around busboy
a day ago15September 06, 202323otherGo
The open source CSV importer
Alternatives To Shrine
Select To Compare

Alternative Project Comparisons


Shrine logo: a red paperclip

Shrine is a toolkit for handling file attachments in Ruby applications. Some highlights:

If you're curious how it compares to other file attachment libraries, see the Advantages of Shrine. Otherwise, follow along with the Getting Started guide.


Resource URL
Website & Documentation
Demo code Roda / Rails
Discussion forum
Alternate Discussion forum



bundle add shrine

Then add config/initializers/shrine.rb which sets up the storage and loads ORM integration:

require "shrine"
require "shrine/storage/file_system"

Shrine.storages = {
  cache:"public", prefix: "uploads/cache"), # temporary
  store:"public", prefix: "uploads"),       # permanent

Shrine.plugin :activerecord           # loads Active Record integration
Shrine.plugin :cached_attachment_data # enables retaining cached file across form redisplays
Shrine.plugin :restore_cached_data    # extracts metadata for assigned cached files

Next, add the <name>_data column to the table you want to attach files to. For an "image" attachment on a photos table this would be an image_data column:

$ rails generate migration add_image_data_to_photos image_data:text # or :jsonb

If using jsonb consider adding a gin index for fast key-value pair searchability within image_data.

Now create an uploader class (which you can put in app/uploaders) and register the attachment on your model:

class ImageUploader < Shrine
  # plugins and uploading logic
class Photo < ActiveRecord::Base
  include ImageUploader::Attachment(:image) # adds an `image` virtual attribute

In our views let's now add form fields for our attachment attribute that will allow users to upload files:

<%= form_for @photo do |f| %>
  <%= f.hidden_field :image, value: @photo.cached_image_data, id: nil %>
  <%= f.file_field :image %>
  <%= f.submit %>
<% end %>

When the form is submitted, in your controller you can assign the file from request params to the attachment attribute on the model:

class PhotosController < ApplicationController
  def create
    Photo.create(photo_params) # attaches the uploaded file
    # ...


  def photo_params

Once a file is uploaded and attached to the record, you can retrieve the file URL and display it on the page:

<%= image_tag @photo.image_url %>

See the Getting Started guide for further documentation.


Shrine was heavily inspired by Refile and Roda. From Refile it borrows the idea of "backends" (here named "storages"), attachment interface, and direct uploads. From Roda it borrows the implementation of an extensible plugin system.

Similar libraries

  • Paperclip
  • CarrierWave
  • Dragonfly
  • Refile
  • Active Storage


Please refer to the contributing page.

Code of Conduct

Everyone interacting in the Shrine project’s codebases, issue trackers, and mailing lists is expected to follow the Shrine code of conduct.


The gem is available as open source under the terms of the MIT License.

Popular File Upload Projects
Popular Upload Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
File Upload
Background Jobs