dev_winse
SylorHuang 6 years ago
parent e8dcb16675
commit 476689314b

@ -18,8 +18,7 @@ class AttachmentsController < ApplicationController
pdf_attachment = params[:disposition] || "attachment" pdf_attachment = params[:disposition] || "attachment"
if pdf_attachment == "inline" if pdf_attachment == "inline"
send_data absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf' send_file absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf'
# render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
else else
send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream') send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream')
end end

Loading…
Cancel
Save