i have a web API project to be consumed from mobile applications and i was trying to make a file upload controller. there are few resources in C# and i don't find anything useful for VB.NET.
i tried this code below converting from c# to VB.NET, but says "Move is not a member of MultiPartFileData".
<pre>Imports System Imports System.Collections.Generic Imports System.IO Imports System.Linq Imports System.Net Imports System.Net.Http Imports System.Threading.Tasks Imports System.Web Imports System.Web.Http Namespace HelloWorld.Controller Public Class FileUploadingController Inherits ApiController <HttpPost> <Route("api/FileUploading/UploadFile")> Public Async Function UploadFile() As Task(Of String) Dim ctx = HttpContext.Current Dim root = ctx.Server.MapPath("~/App_Data") Dim provider = New MultipartFormDataStreamProvider(root) Try Await Request.Content.ReadAsMultipartAsync(provider) For Each file In provider.FileData Dim name = file.Headers.ContentDisposition.FileName name = name.Trim(""""c) Dim localFileName = file.LocalFileName Dim filePath = Path.Combine(root, name) File.Move(localFileName, filePath) Next Catch e As Exception Return $"Error: {e.Message}" End Try Return "File uploaded!" End Function End Class End Namespace
System.IO.File.Move(localFileName, filePath)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)