How to delete a file from server after download

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ligaci
Forum Newbie
Posts: 2
Joined: Tue Feb 12, 2008 3:12 am

How to delete a file from server after download

Post by ligaci »

Hello All :)
I am coding a new file system for my recent project. I dont want to avoid downloading from server directly via a direct link and i decided to copy files to a temporary directory for download. So i need delete temporary files from disc after download session. Do you have any idea about how can i do that ^^

Thanks for your help :drunk:
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: How to delete a file from server after download

Post by mikemike »

You could stream the files rather than just downloading them, probably a better option if you only want them downloaded once.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: How to delete a file from server after download

Post by Zoxive »

Or you could use a cron job to delete the files after so long.
achintha
Forum Newbie
Posts: 13
Joined: Mon Apr 30, 2007 10:21 am

Re: How to delete a file from server after download

Post by achintha »

u can use unlink function.but I think that function is disable on lot of servers.
so if you google it you will be find a good solution than copy & deleting.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: How to delete a file from server after download

Post by Benjamin »

Forum Rules wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
You may also want to read:
  1. General Posting Guidelines
  2. Posting Code in the Forums
  3. PHP Manual
  4. PHP Tutorials
Post Reply