Find file
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (60 sloc) 2.85 KB

File Store

A simple Spree extension that places a tab in the Administration section allowing users to upload files and manage uploaded files. Uploaded files are placed within the public directory and are therefore readable by users of the application.


From the beginning:

  1. Make your spree website 1. For 0.9.x: git clone git:// -b 0.9.x vendor/extensions/file_store For 0.10.x: git clone git:// -b 0.10.x vendor/extensions/file_store
  2. rake db:migrate

And you are ready to go! If you are using capistrano to deploy to your production server, don't forget to share the uploads dir over your releases. See example capistrano snippets at the bottom of this file.

Using The Links

If you want to add any link to a page in your website then the file upload page will give you a link like this:


you should use it in your element like this:


For example, if you wanted to make a link to this pdf:

<a href="/uploaded_files/0000/0002/Gaming.pdf">Gaming PDF</a>


If you are getting a 'Template is missing' error (Missing template admin/uploaded_files/index.erb in view path), then you are probably missing the haml gem. Two options:

  • Require the HAML gem in your environment.rb, or:
  • Use the 'erb' branch that you can find in Robert Massaioli's fork

Example capistrano setup

If you deploy using Capistrano, and don't like 404's, it is important that the 'public/uploaded_files' directory is a) excluded from your Version Control System and b) symlinked to an 'uploaded_files' in a shared dir. You will have to take care of the first thing yourself, and here is a capistrano snippet to set you up for the latter:

  namespace :uploads do
    desc "Create shared uploads dir"
    task :create\_shared\_uploads do
        run "mkdir -p #{shared\_path}/public/uploaded\_files"

    desc "Link public/uploaded_files to shared/public/uploaded_files"
    task :link_uploads do
        run "ln -nfs #{shared_path}/public/uploaded_files #{release_path}/public/uploaded_files"

  after "deploy:setup" do
  after "deploy:update_code" do