0

loadFileAsBase64

To converts a file to base64 format

This function converts a file into a base64 string. You can then use this in a REST API call, for example.

Syntax

loadFileAsBase64(file)

loadFileAsBase64(nid, string)

Return

string

Examples

loadFileAsBase64(record, fileName) To convert a given file from a record's attachment to base64 format.

loadFileAsBase64(this, "myFoto.jpg")

Result: R0lGODlhgACAAPYpAPDNPv///+fBL/L1+Nff6qp9HLWvhvj5+/n7/MKoYNGtQ5urunRTJey4Jfv8/f39/t/l7qmVZe3w9O67J5acotfFjM+PFKy90+SmG+qyIvDAKY+PjbbI3Obs8vHz9vjRL/b4+tCrL7uaKsaUH9mhI4B+e+etH8LR4PfNLufIVaCzzAAAAERERB8fHzwpEfDAJvXQTOTi3/reZnxpUsDAv/z8/ ...

(a base64 string was generated from the file "meinFoto.jpg" from the attachment of the current record)

 

loadFileAsBase64(datei) To convert a given file to base64 format.

loadFileAsBase64(Photo)

Ergebnis: R0lGODlhgACAAPYpAPDNPv///+fBL/L1+Nff6qp9HLWvhvj5+/n7/MKoYNGtQ5urunRTJey4Jfv8/f39/t/l7qmVZe3w9O67J5acotfFjM+PFKy90+SmG+qyIvDAKY+PjbbI3Obs8vHz9vjRL/b4+tCrL7uaKsaUH9mhI4B+e+etH8LR4PfNLufIVaCzzAAAAERERB8fHzwpEfDAJvXQTOTi3/reZnxpUsDAv/z8/ ...

(a base64 string was generated from the file in the image field Photo)

Siehe auch

loadFileAsBasedURL, which converts a file to URL-compliant base64 format.

Reply

null