A small plugin for Frappe that adds customization to the attach control. It supports RTL layout and dark mode out of the box.
A small plugin for Frappe that adds customization to the attach control. It supports RTL layout and dark mode out of the box.
{"allowed_file_types": ["jpg", "png", "gif"]}
You can't modify the original fields of a doctype, so create a new field or clone and modify the entire doctype.
Option | Description |
---|---|
dialog_title 🔴 | Upload dialog title to be displayed 🔶 (Frappe >= v14.0.0). 🔹Example: "Upload Images" 🔹Default: "Upload" |
upload_notes | Upload text to be displayed. 🔹Example: "Only images and videos, with maximum size of 2MB, are allowed to be uploaded" 🔹Default: "" |
disablefilebrowser 🔴 | Disable file browser uploads. 🔶 (File browser is always disabled in Web Form) 🔹Default: false |
allow_multiple | Allow multiple uploads. 🔶 (Field value is a JSON array of files url) 🔹Default: false |
maxfilesize | Maximum file size (in bytes) that is allowed to be uploaded. 🔹Example: 2048 for 2KB 🔹Default: Value of maximum file size in Frappe's settings |
allowedfiletypes | Array of allowed file types (mimes) or extensions to upload. Prefix escaped RegExp string types with $. 🔶 (File extensions must have a leading dot ".") 🔶 (RegExp string types will not be used to in HTML accept attribute) 🔹Example: ["image/", "video/", ".pdf", ".doc", "$audio\/([a-z]+)"] 🔹Default: null or ["image/*"] |
maxnumberof_files | Maximum number of files allowed to be uploaded if multiple upload is allowed. 🔶 (Bypassing the maximum attachments of doctype might not work) 🔹Example: 4 🔹Default: Value of maximum attachments set for the doctype |
cropimageaspect_ratio | Crop aspect ratio for images 🔶 (Frappe >= v14.0.0). 🔹Example: 1 or 16/9 or 4/3 🔹Default: null |
as_public | Force uploads to be saved in public folder by default. 🔹Default: false |
allowed_filename 🔴 | Only allow files that match a specific file name to be uploaded. 🔹Example: (String)"picture.png" or (RegExp String)"/picture-([0-9]+).png/" 🔹Default: null |
allow_reload | Allow reloading attachments 🔶 (Frappe >= v13.0.0). 🔵 Affect the visibility of the reload button.🔵 🔹Default: true |
allow_remove | Allow removing and clearing attachments. 🔵 Affect the visibility of the remove and clear buttons.🔵 🔹Default: true |
Method | Description |
---|---|
enable_reload() | Allow reloading attachments and show the reload button 🔶 (Frappe >= v13.0.0). |
disable_reload() | Deny reloading attachments and hide reload button 🔶 (Frappe >= v13.0.0). |
enable_remove() | Allow removing and clearing attachments and show the clear and remove buttons. |
disable_remove() | Deny removing and clearing attachments and hide the clear and remove buttons. |
set_options(JSON) | Set or change the plugin current options. |
No reviews yet, be the first to review.