I am currently able to send a docx file for the user to download, question is how do I save the file created for download from the send_file
method to store into a local directory in a ruby app?
Below is the code that uses send_file
:
send_file rand_file, :type => 'docx', :filename => "#{@report.report_name}.docx"
I've finally solve my problem by using tips from @katafrakt and @rantingsonrails by using the FileUtils method of copying just before the send_file command. Below are my code on how i did it.
temp_file_path = "./document/#{@report.report_name}.docx"
FileUtils::copy_file(rand_file,temp_file_path)