Please make sure your stream is FileContent since its position is set to 0.
Otherwise, you can turn off image verification by changing the call:
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent);
in
System.Drawing.Image imgFile = System.Drawing.Image.FromStream(afuImageFile.FileContent, true, false);
See Image.FromStream to check for other overloads.
Maxime rouler
source share