I am working with a utility that generates archives (.tar|.zip) on the server, and returns a web page with the archive guid file name. I need to put some very simple code/markup on that page that will download the file and and delete it. I'm pretty sure the best approach is to post an HTML DELETE command after the download. I am aware that I have to configure a DELETE handler in the HTTP server and I'm confident I can figure that part out. I'm just looking for the simplest possible way download and delete the file. I'm open to all solutions, perhaps a special "GET ONCE" handler for Apache in combination with a simple target _blank anchor element.
Asked
Active
Viewed 926 times
0
-
The best way is with a server scripting language (Perl,PHP orPython being obvious candidates) but you've not mentioned any in your question – symcbean Jul 31 '15 at 23:36
1 Answers
0
I just found something here that you could work with...
Detect when browser receives file download
Once you have confirmed that the download has completed, send an ajax call to run a script on your server, passing the token as a variable so you can verify what file is allowed to be deleted and then run a shell command to delete the file from the server. With php, this can be done with the exec()
command.

Community
- 1
- 1

Trung Nguyen
- 519
- 3
- 18