The code looks correct. The error you have could be due to not having write permissions on the directory where you are trying to save the resized image file or maybe you are saving the resized image with the same name as the original file in to the same
directory? Take a look at the following blogs and forum post:
smcoxon
Contributor
5455 Points
948 Posts
Re: Resize Images on upload
Aug 27, 2011 02:28 PM|LINK
The code looks correct. The error you have could be due to not having write permissions on the directory where you are trying to save the resized image file or maybe you are saving the resized image with the same name as the original file in to the same directory? Take a look at the following blogs and forum post:
http://weblogs.asp.net/anasghanem/archive/2009/02/28/solving-quot-a-generic-error-occurred-in-gdi-quot-exception.aspx
http://www.blog.vishalon.net/index.php/bitmapsave-a-generic-error-occurred-in-gdi
http://forums.asp.net/t/624305.aspx
Smcoxon
No Gem is ever polished without some friction.