Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does heroku store uploaded files when using paperclip

I have created a simple ROR application and installed paperclip with this configuration

has_attached_file :attachment,
  :path => ":rails_root/public/system/:attachment/:id/:filename",
  :url => "/system/:attachment/:id/:filename

then i created a simple form that takes the file as input from the user web browser, after that the file url is being displayed model.attachment.url and the user can download the file again.

I tried to run some linux commands to know where are downloaded files are stored 'ls /app/public/system/attachments/' but couldn't all my uploaded files.

Also some files are being uploaded but when trying to get them back i receive 404 error!

has any one experienced such problem before?

like image 838
M.ElSaka Avatar asked Nov 20 '13 18:11

M.ElSaka


People also ask

Where does Heroku store files?

Ephemeral Disk Heroku has an “ephemeral” hard drive, this means that you can write files to disk, but those files will not persist after the application is restarted. By default Active Storage uses a :local storage option, which uses the local file system to store any uploaded files.

Where does Heroku store images?

That said, you can temporarily store images on the Heroku filesystem if you implement a pass-through file upload to an external file store.

Can Heroku store static files?

To answer your question, Heroku's "ephemeral filesystem" will not serve as a storage for static uploads. Heroku is an app server, period. You have to plug into data storage elsewhere.

Can you upload files to Heroku?

Files are uploaded directly to the cloud from your user's browser, without passing through your application. Adding direct uploads to your app allows you to offload the storage of static files from your app. This is crucial on Heroku, because your app's dynos have an ephemeral filesystem.


1 Answers

Heroku keeps paperclip uploaded images for few minutes then automatically removes them, it only keeps images residing in assets. To keep docs or images you need amazon s3 or other web services

like image 65
Rajdeep Singh Avatar answered Sep 30 '22 01:09

Rajdeep Singh