양식 태그에 CSV 파일을 생성하고 사용자가 파일을 클릭하면 다운로드하라는 버튼이 있습니다.Windows에서 클릭하면 '다운로드'파일을 만드는 방법 IE
IE에서이 작업을 수행하려고하면 IE는 IE와 함께 파일을 열려고 시도합니다. 파일을 다운로드하기 만하면됩니다.
내 HTML :
<FORM accept-charset="UTF-8" method="post" action="/generate_csv?calc[]total_interest=189.08">
<DIV style="margin: 0px; padding: 0px; display: inline;"><INPUT name="utf8" value="✓" type="hidden">
<INPUT name="authenticity_token" value="4o1dEDoFbbDoc3scpnhDaQpPtpFM5NitTOrYQA0AU5k=" type="hidden">
</DIV>
<INPUT id="print_csv" name="commit" value="Print CSV" type="submit">
</FORM>
내 레일 컨트롤러 :
headers['Content-Disposition'] = "attachment;"
send_data(csv_string,
:type => 'text/csv; charset=utf-8; header=present; disposition=attachment',
:filename => @filename,
:disposition => 'attachment')
모든 아이디어를 어떻게 이것을 달성하기 위해?
좋은 점, 난 당신이 언급 한 같은 사람들은'faster_csv와 send_data', 그리고 내가 추가 사용하고 아 처분 첨부 변수,하지만 도움이되지 않습니다. – Trip
제출 버튼에서 전송 되었기 때문일 수 있습니까? – Trip
수 있습니다. 간단한 link_to 또는 GET 요청을 해본 적이 있습니까? –