无法传达图像 [英] unable to convet the image
本文介绍了无法传达图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HttpPostedFileBase filel
if (filel != null)
{
logofilename = Path.GetFileName(filel.FileName);
logobytes = new byte[filel.ContentLength];
logoBytestoRead = (int)filel.ContentLength;
logonumBytesRead = 0;
while (logoBytestoRead > 0)
{
int n = filel.InputStream.Read(logobytes, logoBytestoRead, logonumBytesRead);
if (n == 0) break;
logonumBytesRead += n;
logoBytestoRead -= n;
}
objc.CompanyLogo = logobytes;
}
它的givng输出如{0,0,..... 0}
its givng output like{0,0,.....0}
推荐答案
你已经交换了logoBytestoRead
和logonumBytesRead
将这些变量传递给读取
函数。
logonumBytesRead
是必须作为第二个参数传递的偏移量,logoBytestoRead
是数字要读取的字节必须作为第三个参数传递。
所以你传递零字节来读取,没有任何东西被读入你的缓冲区。
You have exchanged thelogoBytestoRead
andlogonumBytesRead
variables when passing them to theread
function.
logonumBytesRead
is the offset which must be passed as second parameter andlogoBytestoRead
is the number of bytes to read which must be passed as third parameter.
So you are passing zero bytes to read and nothing is read into your buffer.
这篇关于无法传达图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文