I've been learning quite a bit from everyone here, however I've come across a problem which I'm having trouble finding an answer to. While attempting to save an image which has been uploaded using AsyncFileUpload I'm receiving the following error: A generic error occurred in GDI+.
I've done quite a bit of Googling and it seems that the most likely issue is permissions related. I've tried allowing write/modify for Network and Network_Serice. Later attempted allowing it for the environment user and finally tested it with "Everyone" - unfortunately it was still not working.
One possible issue is the fact that I'm relying on the built-in development server. I'm still fairly new to it all, so not too sure if there are any limitations in this area or if I'm simply overlooking something obvious.
Code:
try
{
//Attempt to convert file to image
uploadedImage = System.Drawing.Image.FromStream(avatarUpload.PostedFile.InputStream);
//Save image
if (uploadedImage != null)
{
//Create vars
String savePath = Server.MapPath("~/Images/Avatars/");
//Save image
uploadedImage.Save(savePath, ImageFormat.Jpeg); !!! Exception raised here
//Dispose of image
uploadedImage.Dispose();
}
}
catch
{
//Create error message
createMessage("Please ensure you select an image i.e. .bmp, .png, .jpg.", "error");
}
If anyone has any ideas or needs any more info please let me know.
Change
To