Sha256: b67ebafcc73216ed48182ba1dd3cfd15b3a1d9609f331ce0877b42a9f4913a73

Contents?: true

Size: 658 Bytes

Versions: 21

Compression:

Stored size: 658 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

21 entries across 21 versions & 1 rubygems

Version Path
alchemy_cms-2.1.12 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.11 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.9.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.9 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.8.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.8 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.7 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.6 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.5 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.4 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.3 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.2 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.rc6 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.rc5 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.rc4 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.rc3 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.rc2 app/controllers/alchemy/attachments_controller.rb
alchemy_cms-2.1.beta6 app/controllers/alchemy/attachments_controller.rb