Sha256: f3a2c0a43a17faafae4384b4d335ba5a691e01413b99bec5537f42b01ed2749c

Contents?: true

Size: 738 Bytes

Versions: 16

Compression:

Stored size: 738 Bytes

Contents

module Alchemy
  class AttachmentsController < Alchemy::BaseController

    # sends file inline. i.e. for viewing pdfs/movies in browser
    def show
      @attachment = Attachment.find(params[:id])
      send_file(
        @attachment.public_filename,
        {
          :name => @attachment.filename,
          :type => @attachment.content_type,
          :disposition => 'inline'
        }
      )
    end

    # sends file as attachment. aka download
    def download
      @attachment = Attachment.find(params[:id])
      send_file(
        @attachment.full_filename, {
          :name => @attachment.filename,
          :type => @attachment.content_type,
          :disposition => 'attachment'
        }
      )
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
alchemy_cms-2.2.4 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.3.2 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.3.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.2 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.0 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc15 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc14 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc13 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc11 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc8 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc7 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc6 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc3 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc2 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.2.rc1 app/controllers/alchemy/attachments_controller.rb