views:

41

answers:

1

I need a web server that allows me to remove a file after it has been successfully downloaded once. Is there any way to do this with apache?

Is there another web server I can use for this task? I had already looked into Tornado for this purpose, but couldn't find a way to get an event to fire as soon as the download finished. the on_connection_close would only fire when I shut down the server.

I'd prefer something PHP or Python-based if I have to code it myself.

A: 

you might be able to accomplish this with LUA (lighttpd + mod_magnet) - but im not sure... besides that im not aware of any modules that has event triggers on "downloads" there are some that work with uploads like the mod_uploadprogress in lighttpd. im sure nginx has some similar modules... besides that... i think the only solution here is:

http://redmine.lighttpd.net/wiki/lighttpd/HowToWriteALighttpdPlugin

Tobias
oh and fyi - you can not accomplish that over a scripting language - at least i think you cant. because you have to send headers and the content of what the file would be but if the script is done it gets passed on to the webserver daemon which than passes it on to the client - so the real "end" of the file and the socket close is only handled by the webserver... which leads again to the link above ;)
Tobias