views:

27

answers:

1
+2  A: 

You should set the correct MIME type (and extension) to allow Firefox to recognise what kind of file is being downloaded:

send_file "#{RAILS_ROOT}/#{@document.path}", :type => "application/pdf",
  :filename => "document.pdf"

You can read and store this information when the file is being uploaded.

uploaded_file.content_type  # the uploaded file's MIME type
uploaded_file.original_path # name of the file

Even then, if the MIME type is unknown, I don't think you'll get an Open with prompt. So ultimately this will also depend on the particular kinds of files you are using in your application.

molf
Isn't there a way to register Mime types? Could I then register all the different files I'm dealing with so that all files would have the open with option?
Audie
Nevermind I got the Mime type register thing to work -- now it works for all my obscure file types! :D
Audie