1
0
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:
Uncled1023 2018-06-05 18:59:58 -07:00
parent ec39796d85
commit 6c5def43a8
2 changed files with 20 additions and 2 deletions

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

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;