Non-functioning submit button

can you try to switch those two lines ?

<%= end_form_tag %><br>
<%= submit_tag("Download") %>

to

<%= submit_tag("Download") %>
<%= end_form_tag %><br>

your submit butto has something like a context, the form.

Marcel