Пример #1
0
        public Task <string> FileUploadAction(IFormFileCollection files)
        {
            var sb = new StringBuilder().AppendLine("** File upload **").AppendLine($"File count: {files.Count}");

            foreach (var file in files)
            {
                if (file.Length > 0 && file.FileName.EndsWith(".zip", StringComparison.CurrentCultureIgnoreCase))
                {
                    using (Stream zipStream = file.OpenReadStream())
                    {
                        using (ZipArchive archive = new ZipArchive(zipStream))
                        {
                            m_Exec.DeployAndInstall(archive);
                        }
                    }
                    sb.AppendLine($"Did deploy {file.FileName}");
                }
            }
            return(Task.FromResult(sb.ToString()));
        }