locked
Upload Data in online api RRS feed

  • Question

  • User1275635142 posted

    Hi! I want to save new data in an online API in ASP.NET C# Windows form
    If anyone can tell me if it's possible and if it is how can we do it..
    any help will be appreciated.

    Regards

    Monday, July 29, 2019 5:47 PM

All replies

  • User665608656 posted

    Hi itsatifriaz,

    if it's possible and if it is how can we do it..

    Yes, it is possible to do it.

    First, you need to create an empty project of a new WebAPI application, use the post method of the WebAPI to upload files to the web server, write the corresponding method of uploading files in the controller, so that the WinForm application can call the api.

    Then, create a WinForm application and install Microsoft.AspNet.WebApi.Client and Newtonsoft.JSON using NuGet Package Manager.

    Add the upload button and openFileDialog to select the uploaded file in the design page.

    In the click event, upload the file to the file path set by the web server through the URL of the WebAPI .

    For more details, there is a detailed tutorial in this link, you could refer to it:  Consume Web API In Winform For File Handling

    Best Regards,

    YongQing.

    Tuesday, July 30, 2019 7:49 AM