首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

根据文件url如何实现将文件读入byte[] buffer中

2012-12-17 
根据文件url怎么实现将文件读入byte[] buffer中?根据文件url怎么实现将文件读入byte[] buffer中?知道的大

根据文件url怎么实现将文件读入byte[] buffer中?
根据文件url怎么实现将文件读入byte[] buffer中?
知道的大神,赶紧指条明路吧
[解决办法]

引用:
根据文件url怎么实现将文件读入byte[] buffer中?
知道的大神,赶紧指条明路吧

就是本地下载网上文件
[解决办法]
webclient直接down为stream
[解决办法]
 byte[] photo_byte = null;
//strFile 
            using (FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader br = new BinaryReader(fs))
                {
                    photo_byte = br.ReadBytes((int)fs.Length);
                }
[解决办法]
引用:
webclient直接down为stream

DownloadData("");返回byte[]  没有返回stream的吧。用webclient大一点文件会超时,有没其他的方法?
[解决办法]
  string url = "文件地址";
             WebClient wb = new System.Net.WebClient();
             var photo_byte = wb.DownloadData(url);
[解决办法]
引用:
byte[] photo_byte = null;
//strFile 
            using (FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader br ……

FileStream 读的是本地文件路径。我需要http路径。
[解决办法]
引用:
string url = "文件地址";
             WebClient wb = new System.Net.WebClient();
             var photo_byte = wb.DownloadData(url);

我用的就是这个,1M左右文件正常,大一点就超时了

热点排行