I'm trying to solve this issue for 1 week, and i can't seems to solve it.
I search through net, they say its most probably because of permission access.
I have given full rights for all the users, including "Everybody", but error still remains.
This error only will occurs after upload twice, or 3 times, or on the 5th file of uploading. Its random. So i suspect its not the permission access problem.
Below is summary of my codes.
System.Drawing.Image image = ResizeImageImg(fp.PostedFile.InputStream, ImageWidth, ImageHeight);<br />
private System.Drawing.Image ResizeImageImg(Stream streamImage, int maxWidth, int maxHeight)<br />
Bitmap originalImage = new Bitmap(streamImage);<br />
int newWidth = originalImage.Width;
int newHeight = originalImage.Height;
double aspectRatio = (double)originalImage.Width / (double)originalImage.Height;<br />
if (aspectRatio <= 1 && originalImage.Width > maxWidth)<br />
newWidth = maxWidth;<br />
newHeight = (int)Math.Round(newWidth / aspectRatio);<br />
else if (aspectRatio > 1 && originalImage.Height > maxHeight)<br />
newHeight = maxHeight;<br />
newWidth = (int)Math.Round(newHeight * aspectRatio);<br />
System.Drawing.Image CropedImage = new Bitmap(newWidth, newHeight);<br />
using (Graphics grp = Graphics.FromImage(CropedImage))<br />
grp.SmoothingMode = SmoothingMode.HighQuality;<br />
grp.InterpolationMode = InterpolationMode.HighQualityBicubic;<br />
grp.PixelOffsetMode = PixelOffsetMode.HighQuality;<br />
grp.DrawImage(originalImage, 0, 0, newWidth, newHeight);<br />
return CropedImage;<br />
Please help guys. If you do have any simple working codes, please share.