Copy the file to Ruby on Rails

I would like to copy the file from my computer to another specified path. The file must be selected by the user using file_field , and the destination is already hardcoded. How can i do this? Thanks.

+6
source share
1 answer

I would use FileUtils :: cp , but beware of enumerating paths through ../../<file> . You can use expand_path to do this, and then check to see if the resulting path matches your prison.

+12
source

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


All Articles