我在网站中使用 Image.FromStream 方法时遇到了困难。下面的代码在我的电脑上完美运行。但是当我将其上传到测试服务器时,它总是给出“参数无效”异常。
if (!afuImageFile.IsUploading && afuImageFile.HasFile)
{
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent);
}
the afuImageFile
is an AsynFileUploader
Ajax 工具包中的控制。afuImageFile.FileContent
is a HttpInputStream
。我想我需要向某个文件夹添加一些权限。谁能帮我?
请确保您的FileContent
流,因为其位置设置为 0。
否则,您可能需要通过更改以下调用来停用图像验证:
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent);
to:
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent, true, false);
See Image.FromStream https://msdn.microsoft.com/en-us/library/21zw9ah6(v=vs.110).aspx检查其他过载。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)