如题,
解决方案 »
- 求指点:CalendarExtender 控件日历显示不完整的问题
- bmp图像的读取
- 100分~~~1、IE7打印正常,IE6打印不全;2、WinForm里点击Button按钮瞬间(背景是图片)产生的边框,如何去掉?
- 数据库计数问题!
- 两个数据列,数据内容相同的ListView,如何实现数据内容同步(当增加,删除时两个ListView的数据保持一至)?
- 怎样用C#把,此系统的日志记录并备份下来.
- 哪里有C#视频教程下载,BT上的种子,下到一大半,好几天都没有动静了。怎么办?求助。
- 今天生日!进来人人有分!
- 求大神看看通过两级类目控制器件的显示
- 菜鸟问题,如何对SQLSERVER返回的日期时间型字段值进行操作?
- 静态构造函数是怎么回事?
- 再次发贴求助!timer
reqFTP.Credentials = new NetworkCredential(username, password);reqFTP.Timeout = 600000; //Set a time limit for the operation to complete.
reqFTP.ReadWriteTimeout = 10000; //when reading or writing to a stream.
reqFTP.KeepAlive = true;
reqFTP.UseBinary = true stMethods.Ftp.UploadFile;
const int bufferLength = 2048;
byte[] buffer = new byte[bufferLength];
count = 0;
int readBytes = 0;
FileStream fs = fi.OpenRead();
Stream requestStream = reqFTP.GetRequestStream();
do
{
readBytes = fs.Read(buffer, 0, bufferLength);
requestStream.Write(buffer, 0, bufferLength);
count += readBytes;
}
while (readBytes != 0); requestStream.Close();
fs.Close(); FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
response.Close();
也就是即便你的文件小于const int bufferLength = 2048;字节,你也会写一个2048字节出去。估计是大在这里了吧。
换成
requestStream.Write(buffer, 0, readBytes);试试?
有问题吧!每次都是写2048,应该是读多少写多少!!