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?
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.
That said, you can temporarily store images on the Heroku filesystem if you implement a pass-through file upload to an external file store.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With