I am new to cloudinary and Angular. I have been looking for a way to upload the image to cloudinary via without using SDK as cloudinary give us the option to upload the image using post API, I tried the following but didn't succeed.
uploadImage(event) {
var that = this;
this.create_blob(event.srcElement.files[0], function (blob_string) {
that.http.post('https://api.cloudinary.com/v1_1/image/upload/', { file: blob_string}).subscribe(res => {
// url of upload file
})
});
}
create_blob(file, callback) {
var reader = new FileReader();
reader.onload = function () { callback(reader.result) };
reader.readAsDataURL(file);}
I got the following error in console.
HttpErrorResponse {headers: HttpHeaders, status: 401, statusText: "Unauthorized", url: "https://api.cloudinary.com/v1_1/image/upload/", ok: false, …}