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?