welo
07-05-2002, 06:05 PM
Is there a php method whereby I can create a directory and define a limit to the amount of space it consumes? As in, if I wanted to grant someone 10Mb of space on my account, how could this be automatically enforced?
|
||||
Allocating space limits to directorieswelo 07-05-2002, 06:05 PM Is there a php method whereby I can create a directory and define a limit to the amount of space it consumes? As in, if I wanted to grant someone 10Mb of space on my account, how could this be automatically enforced? Jeewhizz 07-05-2002, 07:23 PM only way is to only allow uploads by a PHP script - you can check the space, and either let the upload happen, or not! You can upload more than one file at a time too so it doesn't become restrictive :) Jee closer 07-05-2002, 07:57 PM Or, if you wanted to get even less restrictive... you could setup a directory only for that person to upload to, and use the file functions to read the files in the drirectory and count their sizes. add them all up and if they are more than 10 Megs... he cant upload. To start you off in that direction, you could use readdir() and filesize() in a loop. -Scott welo 07-05-2002, 10:18 PM Okay, so what if the directory contains something to automatically increase its size through a web interface, like a blog, news content or FAQ manager, or even a forum? What would be the best way to apply a readdir() and filesize() loop to this scenario? Ökii 07-05-2002, 10:35 PM disk_total_space (string directory) would return the bytes used for a directory. You could run up a cron job (daily) that meanders quickly through the list of named dirs and tests the byte usage, mailing you when one of them goes above 10meg. Fiddling about with ftp permissions (ie blocking an account that went over the ten) would be a tad harder to say the least. See http://www.php.net/manual/en/function.disk-total-space.php for scriptlets that scan sub directories too. welo 07-07-2002, 07:25 AM Thanks guys. Still digesting this, though at least I have a little more to go on now. Capping the directory size would have to be automatic rather than an emailed advisory. That's a good link though, Okii. I appreciate it. :) |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum