public async Task <ActionResult> UploadData(IFormFile textfile, string folder) { try { // var filename = textfile.FileName.Split('.')[textfile.FileName.Split('.').Length - 1]; // => format file var fileName = textfile.FileName; string pathidentify = _txtconfig.PathIdentify(_env.WebRootPath, folder, "FileManager"); string handlerpath = _txtconfig.HandlerPath(pathidentify, fileName); string temp = handlerpath; bool flag = await _txtconfig.CreateFile(textfile, handlerpath); _logger.Info($"Succes Time: {DateTimeOffset.UtcNow.ToString()} Method Type {MethodType.Uploading.ToString()}"); return((flag) ? StatusCode(200, "Ok") : StatusCode(400, "Bad request")); } catch (Exception ex) { _logger.Error($"Warning Time: {DateTimeOffset.UtcNow.ToString()} Method Type {MethodType.Uploading.ToString()} Error {ex.ToString()}"); //"yyyyMMddHHmmssFFF" throw new ArgumentException("Something is wrong"); } }