Scripter25
asked on
This should be easy Close this connection System.Drawing.Image.FromFile(
Ok here is the code that I know is causing this issue but I need the code so I need a work around for this
System.Drawing.Image scottsimg = System.Drawing.Image.FromF ile(filelo cation + sFilename);
intThumbHeight = (scottsimg.Height * intThumbWidth) / scottsimg.Width;
Here is the Error
The process cannot access the file 'C:\Documents and Settings\Scott\My Documents\Visual Studio 2005\WebSites\shotdrive\im g\178f8f94 -8286-4f3c -bc69-c468 4020fc4b\2 .jpg' because it is being used by another process.
So I assume that when I open that file it is not closing a connection to it. The code that I posted is after I upload an image I need to resize it with out messing up the proportions...
System.Drawing.Image scottsimg = System.Drawing.Image.FromF
intThumbHeight = (scottsimg.Height * intThumbWidth) / scottsimg.Width;
Here is the Error
The process cannot access the file 'C:\Documents and Settings\Scott\My Documents\Visual Studio 2005\WebSites\shotdrive\im
So I assume that when I open that file it is not closing a connection to it. The code that I posted is after I upload an image I need to resize it with out messing up the proportions...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you post the code that saves the file just before the snippet you've given us?
Just reread the question and I think I misunderstood. You are saying that there is code that is creating the file at location filelocation + sFilename and that code is not freeing it up, so when you call FromFile() it cannot access the file? In that case if you can post your code that is doing the uploading we can see why it's not allowing subsequent access to the file.
ASKER
sodalitas you were right I did attempt to use this before and it didnt work but when I tried I used it like this
scottsimg.Dispose;
Instead of this
scottsimg.Dispose();
That is why it didnt work for me the first time.
Thank you for you help on this.....
scottsimg.Dispose;
Instead of this
scottsimg.Dispose();
That is why it didnt work for me the first time.
Thank you for you help on this.....