Need to restrict the attachment variable only able to upload png and jpg images, and the size would be below 2mb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:06 AM
Hi Team,
In the catalog item i have field called 'image' (type is attachment).
in that i need to provide the access only able to upload the images, the image format would be jpg and png.
the image size would be below 2mb.
can anyone help me with the on submit client script.
Regards,
Banu
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:32 AM
You can make use of variable attributes
allowed_extensions Specifies a list of allowed file types. For example, allowed_extensions=txt;pdf.
Applicable variables: Attachment
max_file_size Specifies the maximum file size in MB. For example max_file_size=2.
Applicable variables: Attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:38 AM
if i make this in variable attributes, it is possible to popup the alert messages.
like if user is trying to upload excel file, i need to restrict and popup the alert message"only png and jpg" files are able to submit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:42 AM
You can give it a try, when the user attaches an un-supported attachment format system will alert. Still a better option than scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 03:35 AM
thanks, it works fine jpg and png, when am trying to restict the images size its not working.
i have treid this
allowed_extensions=jpg;png;max_file_size=2;
may i know what is the exact wrong i did?