Gary
asked on
Force file overwrite
I'm using this to write images to the server
Request.Files[IntLoop].Sav eAs(Server .MapPath(" .\\hotels\ \hotel_ima ges\\" + hotelid + "_"+ (IntLoop + 1) + "." + exts));
How can I force it to overwrite the image if exists, I keep getting
The process cannot access the file ....
Request.Files[IntLoop].Sav
How can I force it to overwrite the image if exists, I keep getting
The process cannot access the file ....
Does IUSR_machinename have write access to the folder?
you also made need to see if the file is read-only...
I wonder if there is a flag to do the overwrite....
I wonder if there is a flag to do the overwrite....
ASKER
There is full access to the folder, when the image doesnt exist in the first place its fine, messing around I did a delete first if the image existed followed by a sleep before writing the new image - but this is impractical
As Kev said there must be some flag, in vb you add True to the end of the argument, but this doesnt work in c#
As Kev said there must be some flag, in vb you add True to the end of the argument, but this doesnt work in c#
ASKER
After some testing the problem seems to lie in the getimage.aspx, when I remove the call to this page the uploading works fine, but I can't see what the problem is with this file, everything is disposed etc
You can get the full script at
http://eyeonireland.com/upload.aspx.txt
http://eyeonireland.com/getimage.aspx.txt
...if you want to try testing locally.
You can get the full script at
http://eyeonireland.com/upload.aspx.txt
http://eyeonireland.com/getimage.aspx.txt
...if you want to try testing locally.
ASKER
Ahh solved it, wasnt disposing of
i = System.Drawing.Image.FromF ile(strFil ename)
:)
i = System.Drawing.Image.FromF
:)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.