I've asked the question previously and got many answers, thanks for everyone, but, clearly, I'm doing something wrong.
I have a script that receive an image, and save it like this:
-----------------------------------------------------------------------------------------------------------------
if (fileContents.indexOf('data:image/jpeg;base64') != -1)
fileContents = fileContents.substring('data:image/jpeg;base64,'.length, fileContents.length);
var fileObj = file.create({
name: fileName,
fileType: file.Type.JPGIMAGE,
contents: fileContents,
folder: folderID
});
var fileId = fileObj.save();
--------------------------------------------------------------------------------------------------------------------
I also save the fileId.
This part works very well.
Then later, I have another script that send the image back. That's where my problem is.
How can I reconvert the image to base64 ? Or I maybe all wrong, what else do I need to do ?
Thanks in advance