cubiqsys-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-13  09:48 UTC
How do I force download with LiteSpeed?
Hi!
Searched a long time for this, but haven''t found an answer.
I''m trying to make the user download a special file, no matter what
mediatype it is (could be jpg, pdf or doc for example).
My code right now is this:
def download_path( _id = params[:id])
	result = Philestructure.find( _id )
	headers[''X-LiteSpeed-Location''] = "/downloads/
#{result.phile.file_name}"
	headers[''Content-Description''] = "File Transfer"
	headers[''Content-Type''] =
''application/force-download''
	headers[''Content-Disposition''] = "attachment;
filename=/downloads/
#{result.phile.file_name};"
	headers[''Content-length''] = result.phile.file_size
	render :nothing => true, :status  => 200
end
As you can see it''s a mixed mess of snippets I''ve found on
several
sites. But it won''t work. All it does is rendering the file.
What am I doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
