Obtaining the path to the files loaded from a local machine

I have a custom Doctype in which users can upload images from their local machines.
In the custom Doctype, there is a field to store the local path to the loaded file.

I want to know if there is a way to obtain this path to avoid that the user has to write it manually.

This should work:

from frappe.desk.form.load import get_attachments
from frappe.utils.file_manager import get_file_path

for f in get_attachments(self.doctype, self.name):
    # do something with get_file_path(f.file_name)
2 Likes