zip文件下载后缺少

removeLove removeLove 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下载的zip文件跟服务器上的个数不一样啊
string a = "";
HttpWebRequest myReq = null; HttpWebResponse HttpWResp = null;
try
{

myReq = (HttpWebRequest)HttpWebRequest.Create("http://xxx.xxx.xxx.xx/Images/MomanCamera/background/MomanCamera_background_icons__1000001.zip");
myReq.Timeout = 5000;
HttpWResp = (HttpWebResponse)myReq.GetResponse();
HttpStatusCode httpCode = HttpWResp.StatusCode;
long fileSize = 0;
if (httpCode == HttpStatusCode.OK)
{
Stream myStream = HttpWResp.GetResponseStream();
fileSize = HttpWResp.ContentLength;
byte[] b = new byte[fileSize];
myStream.Read(b, 0, b.Length);

if (b != null)
{

FileStream fs;
FileInfo fi = new FileInfo(@"d:\1.zip");
fs = fi.OpenWrite();
fs.Write(b, 0, b.Length);
fs.Close();
}


}
}
catch (Exception ex)
{

}
finally
{
if (myReq != null)
myReq = null;
if (HttpWResp != null)
{
HttpWResp.Close();
HttpWResp = null;
}
}
...全文
评论 6
收藏 已收藏
分享
返回顶部
removeLove
C# 111,129 成员 642,540 内容