Function Updated 17 Oct 2026
getEmbeddedFile(path, id)
Get bytes of an embedded file (image or file upload) in a specific document.
Parameters
pathstringrequiredAbsolute path of Docly document to get embedded file from.
idstringrequiredID of embedded file to get.
Returns
A byte array. null when the document or the embedded file does not exist, when the path contains .. or a backslash, or when the id contains characters that are not allowed in a file name.
No access check is made: any document in the site can be read.
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
// Read an embedded file from a document. Pass the document's path,
// not its Url (which is URL-encoded).
let path = "Test files/Example file.xlsx";
let p = docly.getFile(path);
let bytes = docly.getEmbeddedFile(path, p.File);
}#