D
D
Dmitry2017-07-23 16:11:39
Ruby on Rails
Dmitry, 2017-07-23 16:11:39

How to implement upload txt file in Rails?

Hello.
How to implement upload txt file from local computer folder in Rails project? Nothing was googled ... Can you tell me a gem or can it be somehow implemented using standard tools? I want to first understand the example of one file, but ideally, you need to implement the uploading of all files from a local folder, followed by processing each file. I hope for the help of the local gurus)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2017-07-23
@mayar

Recommended: carrierwave Popular
alternative : paperclip

N
N. Bekseitov, 2017-07-24
@nbekseitov

Dir.glob("/path_to_folder/*.txt") do |text_file|
  File.open(text_file, "w+") do |f|
     #обработка файла
  end
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question