Skip to content
Advertisement

Image uploading in Angular

I was trying to upload an image using Angular to a google storage bucket. And everything is working fine with Postman. But I’m stuck with angular typescript. Can anyone suggest to me a way to do this?

.html file

JavaScript

.ts file

JavaScript

}

.service file

JavaScript

}

No any error occurs on the backend side. It worked fine with Postman. Im not sure about the .ts file.

Advertisement

Answer

As suggested by @PrasenjeetSymon using FormData will help to upload images in Angular.

Here is the similar thread which demonstrate how to use FormData

You can use the tag from HTML:

JavaScript

and in the component:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement