Hi,
I have this question.
When I use the FileUpload WebControl to post an Image (= SourceFile) that I
want to resize and write to the server, I keep getting this situation.
If that SourceFile is located in My Documents (as in "C:\Documen ts and
Settings\29\Mij n documenten\SubF olderFolder\Img Name.jpg"), I keep getting a
'FileNotFoundEx ception'. That doesn't happen when I get the SourceFile from
"C:\Folder\imgN ame".
What can I do about this ?
Actually I found a workaround, but this gives me an error as well....
I can save the PostedFile like this
PostedFile.Save As(imgPath + "DummyName" );
After which I can do these steps without any problem
System.Drawing. Image srcImage =
System.Drawing. Image.FromFile( imgPath + DummyName);
Graphics graphicOrig = Graphics.FromIm age(srcImage);
graphicOrig.Com positingQuality = CompositingQual ity.HighQuality ;
graphicOrig.Smo othingMode = SmoothingMode.A ntiAlias;
graphicOrig.Int erpolationMode =
InterpolationMo de.HighQualityB icubic;
Rectangle rectOrig = new Rectangle();
graphicOrig.Dra wImage(srcImage , rectOrig);
srcImage.Save(N ewFileName, ImageFormat.Jpe g);
srcImage.Dispos e();
The final srcImage is perfect, and everything I need but when I want to do
this
File.Delete(img Path + dummyName);
I get the IOException that File cannot be deleted:
"The process cannot access the file 'ImgPAth\dummyN ame' because it is being
used by another process."
Does anyone know what I can do about these issues?