I need to get a simple file download to work. I want users to be able to click 'I agree' after scrolling through a license agreement and the click initiates a download of some software which is in a zip file.
I tried using send_file and had some problems I previously posted about. So I am trying to not use send_file. (If anyone can help me with my previous send_file post, that would be great, but please don't suggest send_file otherwise, thanks).
So, I have: <input type=button value="I AGREE" onclick="do_download();"> in one of my rhtml files, where do_download is a javascript fcn: function do_download() { location.href = '/products/download_sample.zip' }
The browser is supposed to see that this is a zip file and put up a pop up window that queries whether to save or open. Standard.
In a vanilla html page, what I want to happen is what happens. When I'm in my RoR site, the browser opens the zip file in a new window, and displays garbage.
This is not a problem that the browser is configured to open zip files. Outside of RoR, it doesn't. But something in Rails (the routes? What?) is making the browser try to open zip files. What is it?
How can I get the behavior I want?
thanks so much!