public async Task <bool> UploadFileAsync(IFormFile file) { try { var dir = Path.Combine(Hosting.ContentRootPath, "wwwroot", "Temp"); _iOService.CreateDirectoryIfNotExist(dir); var path = Path.Combine(dir, file.FileName); //save file in serve to get it's physical path if (await _iOService.WriteFileAsync(file, path)) { //upload saved file to azure CloudBlockBlob cloudBlockBlob = cloudBlobContainer.GetBlockBlobReference(file.FileName); await cloudBlockBlob.UploadFromFileAsync(path); //delete temp file after upload it to azure _iOService.DeleteFileIfExist(path); return(true); } } catch { } return(false); }