How to change the download directory for paperclip on heroku in / tmp?

Do I need to upload files and then parse them using paperclip?

Currently, it boots into the / system folder, which is not allowed in heroku.

I don't need the downloads to be permanent ... I take it apart and then save it.

So, I would like to save in / tmp and then parse it and then let it deflate later.

Thoughts on how to do it (if I do)?

+4
ruby-on-rails heroku paperclip
source share
1 answer

Heroku docs say use tempfile .

Well, this says in the document:

There are two directories: you can write: ./ tmp and. / log (under your application root). If you want to refuse the file temporarily at the time of the request, you can write the file name # {RAILS_ROOT} / TMP / MyFile _ # {Process.pid}. There is no guarantee that this file will be present on subsequent requests (although it may be), so it should not be used for any permanent storage

Then, if you click on the Adam Wiggins link below that, he says that it is accessible through the Tempfile interface.

Using Tempfile is easy, but your file may not exist if heroku thinks different file read / write operations are performed.

# tempfile_example.rb require 'tempfile' # defaults to Dir::tempdir x = Tempfile.new('imagefile.png') puts x.path 

Edit: Answer

The answer should actually be set: path => "" ... but you were close .... - Angela

+2
source share

All Articles