How to use Angular JS API create file?


#1

@benbusse , @toddappleton, @jeffreystables

I am unable to get a file uploaded without it being corrupted to the File storage using the Angular JS File API.

Pleas tell me how to get this uploaded?
Below is the code for the same.

I am uploading this from the camera plugin from a mobile, but even if I directly go and upload from your API_DOCs its failing, which signals me that I am doing something wrong.

It is a small png file, which I am assigning to a body variable and then calling the following:-
var request={};
request.container = “container_name”;
request.file_path = “/image23.png”;
request.body=body;
DreamFactory.api.files.createFile(request);

This without fail corrupts the file. It gets uploaded though.
Can you please correct the mistake I am making.

var body="âPNG

Here above, I had actually pasted the whole content of a small png file, but it vanished, may be due to some invalid characters.


#2

Hi @praveen, this is the third separate forum topic I’ve seen you post this in. This is not a good way to get a unified answer from the community. I recommend reviewing and adhering to our Community Guidelines.


#3

@jeffreystables
I am sorry… this was because I was not getting any response, and was stuck with this for quite some time.
Please let me know if you want me to delete this post and the other?


#4

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


#5