6
index.html.erb形式我如何通過
= form_for :file_upload, :html => {:multipart => true} do |f|
= f.label :uploaded_file, 'Upload your file.'
= f.file_field :uploaded_file
= f.submit "Load new dictionary"
型號
def file_upload
file = Tempfile.new(params[:uploaded_file])
begin
@contents = file
ensure
file.close
file.unlink # deletes the temp file
end
end
指數
def index
@contents
end
但沒有什麼是越來越印在得到臨時文件的內容,我的我上傳文件後的頁面= @contents
如何將內容發送回索引 – ahmet