user2269707
user2269707

Reputation:

web.py:How to make a Hyperlink download a file

I try this <a href='./number.xls'>download</a>,but it didn't work. I know that links get different in web.py, but I just want to know how to click the link and download a file just like we used to do in a static environment.

Upvotes: 1

Views: 543

Answers (3)

Sudhir Jonathan
Sudhir Jonathan

Reputation: 17516

When you say 'just like we used to do in a static enviroment', do you mean you're generating the number.xls file dynamically? Try setting the Content Disposition header if you are

Uses of content-disposition in an HTTP response header

Upvotes: 0

cdonts
cdonts

Reputation: 9599

Store those files in the static directory along with your web.py application. Then use <a href='static/number.xls'>download</a>.

Upvotes: 2

Patrick Healy
Patrick Healy

Reputation: 11

This should work find like you have it.

download is the proper syntax for this operation. Maybe try setting the target from self/blank to new window.

Upvotes: 0

Related Questions