How to use Angular JS API create file?

I moved a post to an existing topic: Image getting corrupted on Upload to the file storage