add sample.csv download

This commit is contained in:
shouchih_chen 2025-06-27 14:24:33 +08:00
parent 04b1aa9874
commit cdfce4ab02
2 changed files with 7 additions and 0 deletions

4
app.py
View File

@ -93,6 +93,10 @@ def upload_csv():
return "File uploaded successfully", 200
@app.route('/download_sample_csv')
def download_sample_csv():
return send_file('resource/sample.csv', as_attachment=True)
if __name__ == '__main__':
# 當在生產環境部署時,不建議使用 debug=True
# 可以指定 host='0.0.0.0' 讓外部可訪問 (在防火牆允許的情況下)

View File

@ -15,6 +15,9 @@
<div id="downloadLink" style="display: none;">
<a id="downloadAnchor" href="#" download="generated_image.png">點擊下載圖片</a>
</div>
<div>
<a href="/download_sample_csv" id="sampleCsvLink" download="sample.csv">下載範例 CSV 檔</a>
</div>
<script>
document.getElementById('uploadForm').addEventListener('submit', async function(event) {