add sample.csv download
This commit is contained in:
parent
04b1aa9874
commit
cdfce4ab02
4
app.py
4
app.py
@ -93,6 +93,10 @@ def upload_csv():
|
|||||||
return "File uploaded successfully", 200
|
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__':
|
if __name__ == '__main__':
|
||||||
# 當在生產環境部署時,不建議使用 debug=True
|
# 當在生產環境部署時,不建議使用 debug=True
|
||||||
# 可以指定 host='0.0.0.0' 讓外部可訪問 (在防火牆允許的情況下)
|
# 可以指定 host='0.0.0.0' 讓外部可訪問 (在防火牆允許的情況下)
|
||||||
|
|||||||
@ -15,6 +15,9 @@
|
|||||||
<div id="downloadLink" style="display: none;">
|
<div id="downloadLink" style="display: none;">
|
||||||
<a id="downloadAnchor" href="#" download="generated_image.png">點擊下載圖片</a>
|
<a id="downloadAnchor" href="#" download="generated_image.png">點擊下載圖片</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="/download_sample_csv" id="sampleCsvLink" download="sample.csv">下載範例 CSV 檔</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('uploadForm').addEventListener('submit', async function(event) {
|
document.getElementById('uploadForm').addEventListener('submit', async function(event) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user