Last post Oct 25, 2010 07:50 AM by skhurams
Aug 04, 2010 04:22 PM|loreahlie11|LINK
to accomplish this. I am getting an error when I try to save the file as the original file name to overwrite it with the modified image file. I know this has got to be something simple that I am overlooking, but I have been looking at it for a while and
can't seem to spot the problem. I currently have the image saved as "studentid_temp.jpg" in the temp folder. I want to overwrite this file with the new cropped version of the photo. Below is the code that i'm using, which gives me the error:
A generic error occurred in GDI+.
When I change the file ending to something different (like studentid_temp1.jpg) the new cropped image saves without a problem because it does not have to overwrite the original.
I have set the permissions on the folder to allow read/write functionality.
Any ideas to easily accomplish this overwrite? I thought overwrite was kind of the default when a file came across with the same name, or is it because I still have the image open from the display (how would I fix that, if that's the problem)?
protected void btnCrop_Click(object sender, EventArgs e)
string studentid = Request.QueryString["studentid"];
originalImage.Crop(Server.MapPath("temp/" + studentid + "_temp.jpg"));
Response.Redirect("/webapps/adpphotoupload/photoEdit.aspx?studentid=" + studentid);
Aug 05, 2010 12:38 AM|qwe123kids|LINK
1} IIS donot have Proper Permission
2} image file is Readonly..
Aug 06, 2010 03:08 PM|loreahlie11|LINK
I have set the folder to full control for all users. When I look at the properties for the image it does not show that it is read-only. I'm almost positive that the image is remaining open after I crop it. I am not sure how to close it though. I have
tried disposing the image, but it doesn't seem to work. I do not use the cropped image anywhere in this portion of the application (I don't display it on a page or open it again).
Another reason I believe it is remaining open is that I get an error when trying to delete the new cropped image in my admin section immediately after the image is submitted. If I wait and try to delete the image half hour to an hour from submission time
then there are no problems.
Any ideas on how I can close it? Is there something besides the dispose() which I am overlooking?
Oct 25, 2010 07:50 AM|skhurams|LINK
Im had the same problem when i used to crop image
i used a delay method and it worked fine
use timer or thread to delay for 5 sec and then save the image
hope this will work