브라우저를 통해 서버 측에서 여러 파일을 다운로드 할 수 있습니다. (예 : Chrome) foreach가 반복적으로 디버깅을 수행했지만 첫 번째 파일 만 다운로드합니다. 내가 좌절감을 느끼고 있기 때문에 어떤 제안이라도 크게 환호 할 것입니다.C# 브라우저를 통해 서버 측에서 배수 파일을 다운로드합니다.
FileInfo fInfo;
SQLConnection = new SqlConnection(SQLConnectionString);
foreach (CartItem CartProduct in Cart.Instance.Items)
{
SQLCom = new SqlCommand("spSelect_T", SQLConnection);
SQLCom.CommandType = CommandType.StoredProcedure;
SQLCom.Parameters.Add(new SqlParameter("@id", CartProduct.ProductId));
SQLConnection.Open();
SQLDReader = SQLCom.ExecuteReader();
if (SQLDReader.Read() == true)
{
fInfo = new FileInfo(Server.MapPath(SQLDReader["t_path"].ToString()));
Response.Clear();
Response.Expires = -1;
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + fInfo.Name + "\"");
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fInfo.FullName);
Response.End();
}
SQLConnection.Close();
}
응답 스트림에서 한 번에 하나의 파일 만 보낼 수 있습니다. 그래서 그들을 gzip 수 있습니다. –