Is it possible to enhance Attach field with folder selection and multi-file support via custom app?

Hi Frappe Team :wave:,

First of all, thank you for building such a powerful and flexible framework — we’re using ERPNext v15 and absolutely love the modularity!

I wanted to request some technical guidance on a feature enhancement for the Attach field.


:mag: Current Behavior:

  • The built-in fieldtypes — Attach and Attach Image — support only single file uploads.
  • When uploading files, we only get a choice to store in either the public or private folders.
  • There is no option to:
    • Select from custom folders like /files/products/
    • Or create a new folder during upload

:white_check_mark: My Suggested Enhancements:

  1. Allow uploading multiple files via Attach field (like how the attachments section works).
  2. Show a dropdown of folders (public ones under /files) for user to select upload destination.
  3. Allow user to create a new folder dynamically inside the upload dialog.
  4. Save uploaded files in the selected or created folder.

:bulb: My Question:

I know this is not available out of the box (yet), but I’d like to know from the Frappe team or community:

:point_right: Can we implement this behavior via a custom app or custom fieldtype?

If yes:

  • What would be the recommended approach to override or extend the Attach field?
  • How can we hook into or replace the file upload dialog (frappe.ui.FileUploader) to inject folder logic?
  • Is there a better approach you’d recommend (e.g., extending attachments sidebar instead)?

Any technical pointers, references, or file/class names to look at would be extremely helpful!

You can get help here:

Hi @ashfaque,
Yes, it’s absolutely possible to upload multiple files at the same time. Please follow the steps below:

Steps:

  1. Create a Custom App:
    Develop a custom app to store your customizations. This app can be deployed on any server. Make sure to write all your code within this custom app for better maintainability.
  2. Add HTML Field for Multi-File Upload:
  • Add a field of type HTML in your Doctype.
  • Use custom HTML and CSS within this field to design a multi-file upload interface.(Use JS file to write HTML, CSS, js code for file upload )
  • Use the /api/method/upload_file API to upload files and insert them into the File doctype.
  1. Allow Folder Selection for File Organization:
    If you want to let users upload files to a specific folder:
  • Provide them with an option to either create a new folder or select an existing one.
  • This helps in organizing uploaded files more efficiently.

Can you please describe more about this app

Hi @M.Toseef
I installed the frappe_cookbook app on my site and created two fields in a Doctype — one as Attach and one as Attach Image. But both fields are showing the same behavior, and I don’t see any difference or changes. Could you please guide me on this?

Thank you!

Hi @Vipul_Kumar
Thanks, this solution is helpful. But I have a question — in ERPNext, the Attach and Attach Image field types are used in many places by default. We can’t manually replace all of them with an HTML field, especially when there are so many.

If it were just one or two fields, this approach would be fine. But since these fields are used throughout ERPNext, how can we change their behavior globally? I also want the same multi-file upload feature in those default Attach fields.

Is there a way to override or customize them across the system?

Thanks in advance!

yes it is possible

In this case you have to check how frappe is giving option for fieldtype and based on that you can develop mutifile upload feature.

Maybe soon? Seems like your post inspired this PR