Are there any way to set CKFinder quota, so that if I set the quota to 100MB, when user try to upload more than 100MB (total) CKFinder will tell me no?
Add public int QuotaSize; //this is in MegaByte Add public string QuotaSetFolder; Also add in constructor as well, and do something like QuotaSetFolder = BaseUrl;
Connector.Config.cs
public int QuotaSize
{
get { return Settings.ConfigFile.Current.QuotaSize; }
}
public string QuotaSetFolder
{
get { return Settings.ConfigFile.Current.QuotaSetFolder; }
}
public long GetDirSize(System.IO.DirectoryInfo dirinfo)
{
long totalSize = 0;
foreach (System.IO.FileInfo fileinfo in dirinfo.GetFiles())
totalSize += fileinfo.Length / 1024 / 1024; //in MB
foreach (System.IO.DirectoryInfo dirinfosub in dirinfo.GetDirectories())
totalSize += GetDirSize(dirinfosub);
return totalSize;
}
language file
500 : 'The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.',
501 : 'The thumbnails support is disabled.',
550 : 'Exceeds Quota'
},
Re: Setting quota?
Settings.ConfigFile.cs
Add public int QuotaSize; //this is in MegaByte
Add public string QuotaSetFolder;
Also add in constructor as well, and do something like QuotaSetFolder = BaseUrl;
Connector.Config.cs
public int QuotaSize { get { return Settings.ConfigFile.Current.QuotaSize; } } public string QuotaSetFolder { get { return Settings.ConfigFile.Current.QuotaSetFolder; } }Connector.Errors.cs
public const int ExceedsQuota = 550;
CKFinder.Connector.CommandHandlers.FileUploadCommandHandler.cs
public long GetDirSize(System.IO.DirectoryInfo dirinfo) { long totalSize = 0; foreach (System.IO.FileInfo fileinfo in dirinfo.GetFiles()) totalSize += fileinfo.Length / 1024 / 1024; //in MB foreach (System.IO.DirectoryInfo dirinfosub in dirinfo.GetDirectories()) totalSize += GetDirSize(dirinfosub); return totalSize; }language file
config.ascx
public override void SetConfig() { QuotaSize = 1; QuotaSetFolder = @"C:\Inetpub\wwwroot";