Rails 3: Fileupload without generating a temporary file

I am looking for a way to upload a file to a Rails 3 application, but without creating a temporary file. Looking at the problem gave me some insight into how file loading works. As far as I understand, Rails creates a temporary file when the file size is more than 20 KB. Is there a way to change this limit and avoid generating a temp file?

Another solution I was looking for was to create a Rack application and therefore avoid creating the file, however, it did not work either. Same thing with the Sinatra app.

Btw. Yes, it is imperative that the file is not saved and only be stored in memory for security reasons.

thanks

+4
source share
2 answers

Check out https://github.com/jnicklas/carrierwave I don't think it uses a temporary file when saving to disk (or other storage locations)

0
source

MatthewFord , this is ...

self.class.new({:tempfile => new_path, :content_type => content_type}) 
0
source

Source: https://habr.com/ru/post/1347236/


All Articles