Class: ElFinder2::Command::File
- Defined in:
- lib/el_finder2/command/resize.rb
Overview
Output file into browser. This command applies to download and preview actions.
Instance Method Summary collapse
-
#execute ⇒ Object
May need to set Content-Disposition, Content-Location and Content-Transfer-Encoding.
Methods inherited from Base
Methods included from HashUtils
#from_base64url, #to_base64url, #to_path
Constructor Details
This class inherits a constructor from ElFinder2::Command::Base
Instance Method Details
#execute ⇒ Object
May need to set Content-Disposition, Content-Location and Content-Transfer-Encoding. Content-Disposition should have ‘inline’ for preview action or ‘attachments’ for download.
9 10 11 12 13 14 15 16 |
# File 'lib/el_finder2/command/resize.rb', line 9 def execute if @download data = Paperclip.io_adapters.for(@file.content) send_data(data.read, filename: @file.name, type: @file.content_type) else redirect_to @file.content.url end end |