ImageUploadEditorAttribute class
namespace: Serenity.ComponentModel assembly: Serenity.Net.Core
Sets editor type as "ImageUpload", which only allows image files. Make sure you use this attribute in Row.cs, not Form.cs as the image upload behavior only works if it is in row, otherwise your files will stay in temporary directory.
[AttributeUsage(AttributeTargets.All)]
public class ImageUploadEditorAttribute : CustomEditorAttribute
Public Members
| name | description |
|---|---|
| ImageUploadEditorAttribute() | Initializes a new instance of the ImageUploadEditorAttribute class. |
| AllowNonImage { get; set; } | Should non-image uploads be allowed. |
| CopyToHistory { get; set; } | Should a copy of file placed in a special history folder on upload. This helps preserving old files on update. |
| DisableDefaultBehavior { get; set; } | If you don't want ImageUploadBehavior to process this upload, and want to handle it manually, set to true (not recommended) |
| DisplayFileName { get; set; } | If you have no original name property but use original name in file name with {4} format parameter, set this to true to force ImageUploadEditor show file name. |
| FilenameFormat { get; set; } | Format of the file name like "ProductImage/{1:00000}/{0:00000000}_{2}". Parameter 0 is the row identity value, 1 is identity value / 1000, and 2 is a random string like 2cxs4bc, 3 is current date/time, 4 is original file name. You can also use the shortcut "ProductImage/" which is equivalent to the prior sample. If you don't specify this, it will default to something like Product/ProductImage/ which is generated by combining row class name and field name. |
| JsonEncodeValue { get; set; } | Only useful for MultipleImageUploadeEditor. Specifies whether to JSON encode value. If your field is a string field set it to true. |
| MaxHeight { get; set; } | Maximum height in pixels of the uploaded image. |
| MaxSize { get; set; } | Maximum size in bytes of the uploaded file. |
| MaxWidth { get; set; } | Maximum width in pixels of the uploaded image. |
| MinHeight { get; set; } | Minimum height in pixels of the uploaded image. |
| MinSize { get; set; } | Minimum size in bytes of the uploaded file. |
| MinWidth { get; set; } | Minimum width in pixels of the uploaded image. |
| OriginalNameProperty { get; set; } | If you want to store original name of the file uploaded, set this to the name of another string field. Only used for single image uploads. |
| ScaleHeight { get; set; } | What height image should be scaled to. Default value of 0 disables it. |
| ScaleMode { get; set; } | What kind of image scaling should be used to generate image. |
| ScaleQuality { get; set; } | Quality of scaled image (not thumb), default is 80. |
| ScaleSmaller { get; set; } | Should image be scaled up to requested size when its smaller |
| ScaleWidth { get; set; } | What width image should be scaled to. Default value of 0 disables it. |
| ThumbMode { get; set; } | What kind of image scaling should be used to generate thumbnails. |
| ThumbQuality { get; set; } | Quality of thumbnails, default is 80. |
| ThumbSizes { get; set; } | List of thumbnail sizes requested. Something like "96x96;128x128;200x200" |
| const Key | Editor type key |
Protected Members
| name | description |
|---|---|
| ImageUploadEditorAttribute(…) | Initializes a new instance of the ImageUploadEditorAttribute class. |
See Also
- class CustomEditorAttribute
- Source: ImageUploadEditorAttribute.cs