C# &引用;参数无效";System.Drawing.Image.FromStream()方法的异常
我在我的网站上使用Image.FromStream方法时遇到了困难。下面的代码在我的电脑上运行得很好。但是当我把它上传到测试服务器时,它总是给我“Parameter not valid”异常C# &引用;参数无效";System.Drawing.Image.FromStream()方法的异常,c#,asp.net,system.drawing,C#,Asp.net,System.drawing,我在我的网站上使用Image.FromStream方法时遇到了困难。下面的代码在我的电脑上运行得很好。但是当我把它上传到测试服务器时,它总是给我“Parameter not valid”异常 if (!afuImageFile.IsUploading && afuImageFile.HasFile) { System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileConte
if (!afuImageFile.IsUploading && afuImageFile.HasFile)
{
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent);
}
afuImageFile
是Ajax工具包中的AsynFileUploader
控件afuImageFile.FileContent
是一个HttpInputStream
。我想我需要向某个文件夹添加一些权限。有人能帮我吗?请确保您的文件内容流的位置设置为0
否则,您可能希望通过更改以下调用来停用图像验证:
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent);
致:
请参阅以检查其他重载。听起来与此问题类似。
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent, true, false);