public IActionResult Upload() { try { var file = Request.Form.Files[0]; var folderName = "TableFiles"; var pathToSave = Path.Combine(Directory.GetCurrentDirectory(), folderName); if (file.Length > 0) { var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); var fullPath = Path.Combine(pathToSave, fileName); var dbPath = Path.Combine(folderName, fileName); using (var stream = new FileStream(fullPath, FileMode.Create)) { file.CopyTo(stream); } TableFile tableFile = new TableFile(); tableFile.FileName = fileName; tableFile.SetColumns(fullPath); return(Ok(tableFile)); //return Ok(new { dbPath }); } else { return(BadRequest()); } } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }