I’m using web.py for a small project and I have files I want the user to be able to access in /files directory on the server. I can’t seem to find how to return a file on a GET request so I can’t work how to do this.
Exactly want to do essentially is:
urls = ('/files/+', 'files')
class files:
def GET(self)
#RETURN SOME FILE
Is there a simple way to return a file from a GET request?
Playing around I came up with this webpy GET method:
Other respondants are correct when they advise you consider carefully the security implications. In my case we will include code like this to an administrative web service that will be (should be!) available only within our internal LAN.