Mido
-
Posts
6 -
Joined
-
Last visited
Posts posted by Mido
-
-
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!
-
How can I sort a string alphabetically? I thought about creating an array ('a'=>0, 'b'=>1) etc, but didn't manage to work. So how can I do this? is there a predefined function for this? or I should create the algorithm? Thanks,
Example:
$word = 'cbad432'; // should become: '234abcd'
-
I thought about adding throw-statement after the two if statements. Would that do it?
-
Hello
It's about exception handling...
I have two if statements, one inside the other. And I want to throw an exception from each, if one of them is FALSE. What "technique" should I use? I think throwing same exception with the same message within two if's is a bit messy.
like:
if $x is true
//go to 2nd if:
if $y is true
return value
if $y is false: throw exception "Invalid number"
if $x is false: throw exception "Invalid number"
Thanks,
-
Hello, I'm a beginner in regex. Basically, what I want is to match a specified number of integers in a string. Like, :
$str="123-456-789" // phone number...
I want to check, via preg_match(), whether the string contains [7-15] digits. So, 123-456-789-321-654 would be valid; they contain 20 characters, but only 15 digits, so it's within the interval range.
I thought about validating the string then stripping out the hyphens/spaces then count the final filtered version of the string. But I'd rather do them all in one regex pattern. Is there a way to do that?
If it wasn't clear enough, please tell which part wasn't. Thanks.
Limit upload capacity for user (PHP/MySQL)
in PHP Coding Help
Posted
Thank you. But, what if I got files already there? How can I:
[*]Know their number
[*]Calculate their size