Viliam
Viliam

Reputation: 196

How to download files from web2py server

When I wanted to allow someone to download some file from my server using apache, I just copied file to /var/www folder and sent link to that person.

How do I do same thing using apache+web2py configuration? I don't need any fancy security. I just want direct link to file. I tried to google solution, but every solution I found is too complicated for such goal as I'm trying to achieve (i.e. streaming files).

There is no easy way to do it?

Upvotes: 0

Views: 2513

Answers (1)

Anthony
Anthony

Reputation: 25536

If you just want to put some files in a folder and serve them directly, you can do that with just apache -- no need for web2py.

If you really want web2py to serve the files, you can put them in /web2py/applications/yourapp/static/path/to/file, and serve them with URLs like /yourapp/static/path/to/file.

If you want to apply some authentication checks, you can instead put files in the /uploads or /private folder of your web2py app and serve them via a function that calls response.download() (in the case of file uploads based on database "upload" fields) or response.stream() (in the case of files you manually place on the server).

Upvotes: 3

Related Questions