ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Obtaining the path to the files loaded from a local machine

custom_script
custom_field
files
custom-app

#1

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.


#2

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)

#3