CuteEditor for .NET

Restricting Image Uploads By Size, Width and Height

How to Limit the Size of Image Files



You can easily limit the size of the image files using the following methods:

1: Edit security policy file:


The security policy file (default.config, admin.config and guest.config) can be found in the /CuteEditor/Configuration/Security folder. In security policy file you can find the MaxImageSize element which contains the value of max image file upload size limit (in kbs).  By default, it contains the following value:


<
security name="MaxImageSize">100</security>
  

You can modify the MaxImageSize element to meet your own requirements.

For example:

<security name="MaxImageSize">200</security>

2: Programmatically limit the size of the image files:


C# Example:

Editor1.Setting["security:MaxImageSize"]= "200";
or
Editor1.SetSecurityMaxImageSize= "200";


VB Example:

Editor1.Setting("security:MaxImageSize")= "200"
or
Editor1.SetSecurityMaxImageSize= "200"

 

Upload Images With Dimension Restrictions

 

Specify what set dimension restrictions will be when uploading the images.

 

 

 

You can easily specify where or not set dimension restrictions when uploading the images using the following methods:

1: Edit security policy file:


In security policy file you can find the RestrictUploadedImageDimension element.  By default, it contains the following value:


<
security name="RestrictUploadedImageDimension">true</security>
  

You can modify the RestrictUploadedImageDimension element to meet your own requirements.

For example:

<security name="RestrictUploadedImageDimension">false</security>

2: Programmatically specify where or not set dimension restrictions when uploading the images files:


C# Example:

Editor1.Setting["security:RestrictUploadedImageDimension"]= "true";


VB Example:

Editor1.Setting("security:RestrictUploadedImageDimension")= "true"

 

Specify the maximum width/height of the image files to be uploaded.


 

 

You can easily specify the maximum width/height of the image files to be uploaded using the following methods:

1: Edit security policy file:


In security policy file you can find the MaxImageWidth element and MaxImageHeight element.  By default, they contain the following value:


<
security name="MaxImageWidth">640</security>
<
security name="MaxImageHeight">480</security>
  

You can modify the MaxImageWidth element and MaxImageHeight element to meet your own requirements.

For example:

<security name="MaxImageWidth">1280</security>
<
security name="MaxImageHeight">960</security>

2: Programmatically specify the maximum width/height of the image files to be uploaded:


C# Example:

Editor1.Setting["security:MaxImageWidth"]= "1280";
Editor1.Setting["security:MaxImageHeight"]= "960";
or
Editor1.SetSecurityMaxImageDimension(1280,960);
SetSecurityMaxImageDimension


VB Example:

Editor1.Setting("security:MaxImageWidth")= "1280"

Editor1.Setting("security:MaxImageHeight")= "960"
or
Editor1.SetSecurityMaxImageDimension(1280,960)