The parameters for attaching the file. This includes:
filename: The name of the file to be attached.fileData: The data of the file, which can be in base64-encoded format.doctype: The type of document to which the file will be attached.docname: The name or identifier of the document to which the file will be attached.folder (optional): The folder where the file will be stored. If not specified, the file is attached to the default location.base64_decode (optional): Whether to decode the fileData from base64 format. Defaults to false.is_private (optional): Whether the file should be marked as private. Defaults to true.docfield (optional): The specific field in the document where the file should be attached. If not specified, the file is attached generally to the document.A promise that resolves to a File object representing the attached file. The File object includes details about the file, such as its name, URL, and metadata.
Attaches a file to a specific document in the system.
This function performs an asynchronous request to the server to attach a file to a document. The file is specified by the
filenameandfileDataparameters, and it is attached to the document identified bydoctypeanddocname. Additional parameters likefolder,base64_decode,is_private, anddocfieldcan be used to control the attachment behavior and file handling.Example
Example
Throws
Throws an error if the request fails or if there is an issue with attaching the file.