Browse Source

Fixed max upload size not taking into account basic/premium

tags/3.0.0
Teknikode 2 years ago
parent
commit
6c5def43a8

+ 10
- 1
Teknik/Areas/API/Controllers/APIv1Controller.cs View File

@@ -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);

+ 10
- 1
Teknik/Areas/Upload/Controllers/UploadController.cs View File

@@ -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…
Cancel
Save