Silver Posted April 26, 2003 Share Posted April 26, 2003 Hello! I\'m trying to make a script where users can upload their files, but the files they upload can only be downloaded X amount of times. After they\'ve been downloaded so many times in an ideal world they\'d be automatically removed, though just to be made so people couldn\'t download them anymore would be great. I\'ve made the upload part, I was told the best way would probably be to - 1. Store the files in a database and have a field that has a value that is how many times it can be downloaded. 2. Then a page that allows users to download. 3. For each download you can decrement that download field by one. 4. When you display the link for all the download files you can display all the downloads that do not have your available download field = 0... Either could I have some help in how to store files in a mySQL database, or could you advise me of a better way to do this please? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/398-storing-files-in-a-database/ Share on other sites More sharing options...
shivabharat Posted April 26, 2003 Share Posted April 26, 2003 storing in db means storing the link of the file. u can retrive this link and show to the users Now what u have said is ok and i think u can goahead doing that. u have to maintain a value in the db which u have to decrement or incerement as u said. But be sure u do the update in a intermediate page. Like if dont have a intemediate page when I click on the refresh ur value will be still decremented weven though i havent downloaded them. Quote Link to comment https://forums.phpfreaks.com/topic/398-storing-files-in-a-database/#findComment-1336 Share on other sites More sharing options...
Silver Posted April 26, 2003 Author Share Posted April 26, 2003 Ok, let\'s start at the beginning, I\'ve never done this before and am still quite a newbie to php storing in db means storing the link of the file. u can retrive this link and show to the users Ok, how do I do that? Now what u have said is ok and i think u can goahead doing that. Good Now I just need to learn how u have to maintain a value in the db which u have to decrement or incerement as u said. I have the right theory then, if I can just learn how to put it into practise it should be great! But be sure u do the update in a intermediate page. Like if dont have a intemediate page when I click on the refresh ur value will be still decremented even though i havent downloaded them. Which update? And how do you mean an intermediate page? Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/398-storing-files-in-a-database/#findComment-1337 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.