mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Fixed max upload size not taking into account basic/premium
This commit is contained in:
parent
ec39796d85
commit
6c5def43a8
@ -43,7 +43,16 @@ namespace Teknik.Areas.API.Controllers
|
||||
{
|
||||
if (model.file != null)
|
||||
{
|
||||
if (model.file.ContentLength <= Config.UploadConfig.MaxUploadSize)
|
||||
long maxUploadSize = Config.UploadConfig.MaxUploadSize;
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
maxUploadSize = Config.UploadConfig.MaxUploadSizeBasic;
|
||||
if (User.Info.AccountType == AccountType.Premium)
|
||||
{
|
||||
maxUploadSize = Config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
if (model.file.ContentLength <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
string fileExt = Path.GetExtension(model.file.FileName);
|
||||
|
@ -60,7 +60,16 @@ namespace Teknik.Areas.Upload.Controllers
|
||||
{
|
||||
if (Config.UploadConfig.UploadEnabled)
|
||||
{
|
||||
if (data.ContentLength <= Config.UploadConfig.MaxUploadSize)
|
||||
long maxUploadSize = Config.UploadConfig.MaxUploadSize;
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
maxUploadSize = Config.UploadConfig.MaxUploadSizeBasic;
|
||||
if (User.Info.AccountType == AccountType.Premium)
|
||||
{
|
||||
maxUploadSize = Config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
if (data.ContentLength <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
int contentLength = data.ContentLength;
|
||||
|
Loading…
Reference in New Issue
Block a user