Mido Posted September 29, 2011 Share Posted September 29, 2011 Hello! I want to make the users in the website able only to upload, for example, 1 GB, so that when a user finishes the 1 GB available for his files, he cannot upload more files. I know how to set up upload limit for a single file in the upload page, or even globally for anyone to upload. But I would like to know how to make each user has specific capacity, and how it is updated so that if he uploads 0.5 GB he has only 0.5 GB left. I thought of creating a column in the `users` or something concerning upload limit that I will set it (one GB for example). If I will do that, how will I be able to determine how much he uploaded? Any help would be appreciated. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/248137-limit-upload-capacity-for-user-phpmysql/ Share on other sites More sharing options...
ManiacDan Posted September 29, 2011 Share Posted September 29, 2011 I thought of creating a column in the `users` or something concerning upload limit that I will set it (one GB for example). If I will do that, how will I be able to determine how much he uploaded? When they upload something, record how big it was. Quote Link to comment https://forums.phpfreaks.com/topic/248137-limit-upload-capacity-for-user-phpmysql/#findComment-1274188 Share on other sites More sharing options...
Mido Posted September 30, 2011 Author Share Posted September 30, 2011 Thank you. But, what if I got files already there? How can I: [*]Know their number [*]Calculate their size Quote Link to comment https://forums.phpfreaks.com/topic/248137-limit-upload-capacity-for-user-phpmysql/#findComment-1274524 Share on other sites More sharing options...
jcbones Posted September 30, 2011 Share Posted September 30, 2011 You would keep the total of their uploads. So, when they uploaded something new, you add it to the previous amount, and when the delete something you ... There is no need to know the number of files they have, unless you are going to limit that also. To calculate the files a user already has, just pass them to the filesize() function, and keep a running total. Quote Link to comment https://forums.phpfreaks.com/topic/248137-limit-upload-capacity-for-user-phpmysql/#findComment-1274525 Share on other sites More sharing options...
ManiacDan Posted October 1, 2011 Share Posted October 1, 2011 So you have a whole bunch of files on your filesystem but you don't know who uploaded what? unless you specifically logged this information you cannot get it back. You can start from right now and start recording, but there's no way to add up a random number of files based on which web user created them. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/248137-limit-upload-capacity-for-user-phpmysql/#findComment-1274561 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.