This came up again and after a disappointing silence from the forum, I decided to have a hack around with FileWorkerBase.cs, TypeConfig.cs and Config.cs.
My solution is:
Add a public int MaxUploadSize prop to the TypeConfig class Add lines similar to this where necessary in Config.cs to limit the file size for specific resoures: TypeConfig[ "Image" ].MaxUploadSize = 40960; Add this code to FileWorkerBase as a validation method before the file is saved: if ((this.Config.TypeConfig[resourceType].MaxUploadSize != -1) && (oFile.ContentLength > this.Config.TypeConfig[resourceType].MaxUploadSize)) { this.SendFileUploadResponse(1, true, "", "", "The file is too large"); return; }
When the file is too large the Javascript "The file is too large" message appears from the upload response. I don't know if this is what should be done but it's working.
Re: fckeditor quickupload, set max file size for images / files
My solution is:
Add a public int MaxUploadSize prop to the TypeConfig class
Add lines similar to this where necessary in Config.cs to limit the file size for specific resoures: TypeConfig[ "Image" ].MaxUploadSize = 40960;
Add this code to FileWorkerBase as a validation method before the file is saved:
if ((this.Config.TypeConfig[resourceType].MaxUploadSize != -1) && (oFile.ContentLength > this.Config.TypeConfig[resourceType].MaxUploadSize))
{
this.SendFileUploadResponse(1, true, "", "", "The file is too large");
return;
}
When the file is too large the Javascript "The file is too large" message appears from the upload response. I don't know if this is what should be done but it's working.