Sha256: a8abc50c0976510955aaca86e44782c1ee7e4368b1f33db8cba0e534f6600c5e

Contents?: true

Size: 665 Bytes

Versions: 17

Compression:

Stored size: 665 Bytes

Contents

class AttachmentsController < AlchemyController
  
  # 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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
alchemy_cms-2.0.7 app/controllers/attachments_controller.rb
alchemy_cms-2.0.6.1 app/controllers/attachments_controller.rb
alchemy_cms-2.0.5 app/controllers/attachments_controller.rb
alchemy_cms-2.0.4 app/controllers/attachments_controller.rb
alchemy_cms-2.0.3.1 app/controllers/attachments_controller.rb
alchemy_cms-2.1.beta1 app/controllers/attachments_controller.rb
alchemy_cms-2.0.3 app/controllers/attachments_controller.rb
alchemy_cms-2.0.2 app/controllers/attachments_controller.rb
alchemy_cms-2.0.1 app/controllers/attachments_controller.rb
alchemy_cms-2.0 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc6 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc5 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc4 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc3 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc2 app/controllers/attachments_controller.rb
alchemy_cms-2.0.rc1 app/controllers/attachments_controller.rb
alchemy_cms-2.0.pre5 app/controllers/attachments_controller.rb