upload the image from angular form to cloudinary using .NET API

rwahdan
rwahdan Member Posts: 51
edited May 1 in Developer APIs

Hi,

I am trying to upload a photo to cloudinary from an angular form:

<form id="stripe-login">
<div class="field padding-bottom--24">                 

<label for="pname">Publication Name</label>                 

<input type="text" name="pname" id="pname" [(ngModel)]="pname">               

</div>
<div class="field padding-bottom--24">                 

<textarea name="desc" cols="40" rows="5" [(ngModel)]="desc"></textarea>               

</div>

<div class="field padding-bottom--24">                 

<input type="file" id="myFile" [(ngModel)]="filename">               

</div>

<div class="field padding-bottom--24">                 

<input (click)="publishNews()" type="submit" name="submit" value="Continue">               

</div>

</form>

in .NET API how to upload the file from that form to coudinary? I found this in your documentation:

public ImageUploadResult Upload(ImageUploadParams parameters);

but i need more details how to pass the photo from my form to my API and how to work with it?

Answers

  • DannyFromCloudinary
    DannyFromCloudinary Member, Cloudinary Staff Posts: 132

    Hey @rwahdan! Thanks for getting in touch.

    I'm afraid we're not able to provide a specific code sample in this case, but at a high level, what you would need to do is create an endpoint in your .NET application that will accept a POST request, handle the parameters accordingly, and then call the Upload() method of the Upload API.

    From the frontend, you'd then use your Angular form to POST to this endpoint.

    I'm sorry I can't provide a more direct example, but I hope this helps. If you have any further questions, please let us know, and we will do our best to help.

    Kind regards,

    -Danny