hi i would like to know how I can create a temporary file image (png) in ruby, because tempfile only gets you a random file name but it doesn't have an extension file.
Asked
Active
Viewed 3,236 times
1 Answers
7
# Use the Array form to enforce an extension in the filename:
file = Tempfile.new(['hello', '.jpg'])
file.path # => something like: "/tmp/foo2843-8392-92849382--0.jpg"

Dutow
- 5,638
- 1
- 30
- 40