Click here to Skip to main content
15,076,130 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to ASP.net. My experience has been on winforms using VB.net, and I have been struggling with my first api call. I am using VS 2019. I spent a few hours researching but couldn't find what I need. I want to upload a file to a web api and then access that file on the server. I tried using <httppost> but got errors. The GetValues is successfully called, but is this what I need?

What I have tried:

<form action="/api/Values " >	
	<!-- method="post" enctype="multipart/form-data" -->
        <div>

            <input type="file" id="btn_FileUpload" name="btn_FileUpload"
                   class="btn btn-primary">

            <input type="submit" id="btn_submit" name="btn_submit">

        </div>
</form>


Public Class ValuesController
    Inherits ApiController

    Public Function GetValues() As IEnumerable(Of String)

	    I want to get the file here

        Return New String() {"value1", "value2"}
    End Function

End Class
Posted
Updated 20-Aug-21 11:56am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900