private async void TakePhoto_Clicked(object sender, EventArgs e) { var file = await MediaPicker.CapturePhotoAsync(); var content = new MultipartFormDataContent(); content.Add(new StreamContent(await file.OpenReadAsync()), "file", file.FileName); string url = "https://10.0.2.2:7254/api/GetData/Upload/"; client.BaseAddress = new Uri(url); var response = await client.PostAsync("", content); if (response.IsSuccessStatusCode) } Web API [HttpPost] [Route("Upload")] public async Task<string> Upload( List <IFormFile> files) { try { foreach (var formFile in files) { if (formFile.Length > 0) { var fileName = formFile.FileName.Split('\\').LastOrDefault().Split('/').LastOrDefault(); var filePath = Path.Combine(Directory.GetCurrentDirectory(), "imagenes", fileName); using (var stream = System.IO.File.Create(filePath)) { await formFile.CopyToAsync(stream); }
var filename = path.getfilename(formFile) // to break the big string and get the filename and extension only
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)