emilybartholomew
Technical User
Hello-
I am creating a web interface for a database in which I store lots and lots of data. The idea is that people can come to the website and and select what kind of data they want to see, such as: "Energy Prices between may 2001 and july 2001" or "Load between january 2000 and december 2001" or whatever they wish.
I can display the data fine on the page, but I am also supposed to allow users to download a .txt/.csv/.zip (doesn't matter) file of this data to their own computers.
My thinking so far is this: when they submit their query, my program should create a file and put it in a directory. Then when the page appears with the data have a link to this file. If they click off of the page (with or without downloading the file), it will disappear from my server forever. I would like to avoid a ginormous build up of useless files. I have not been able to implement it yet. I can probably create the file, but how would you delete it? I guess I could just delete once a day (as a cron job or something - I'm running Linux) but on the off chance someone is downloading at the moment the job runs, I'd like to not do this.
Has anyone ever done anything like this?
Thanks-
emily
I am creating a web interface for a database in which I store lots and lots of data. The idea is that people can come to the website and and select what kind of data they want to see, such as: "Energy Prices between may 2001 and july 2001" or "Load between january 2000 and december 2001" or whatever they wish.
I can display the data fine on the page, but I am also supposed to allow users to download a .txt/.csv/.zip (doesn't matter) file of this data to their own computers.
My thinking so far is this: when they submit their query, my program should create a file and put it in a directory. Then when the page appears with the data have a link to this file. If they click off of the page (with or without downloading the file), it will disappear from my server forever. I would like to avoid a ginormous build up of useless files. I have not been able to implement it yet. I can probably create the file, but how would you delete it? I guess I could just delete once a day (as a cron job or something - I'm running Linux) but on the off chance someone is downloading at the moment the job runs, I'd like to not do this.
Has anyone ever done anything like this?
Thanks-
emily