Solved

Force file overwrite

Posted on 2007-03-26
7
777 Views
Last Modified: 2008-01-09
I'm using this to write images to the server

 Request.Files[IntLoop].SaveAs(Server.MapPath(".\\hotels\\hotel_images\\" + hotelid + "_"+ (IntLoop + 1) + "." + exts));

How can I force it to overwrite the image if exists, I keep getting
The process cannot access the file ....
0
Comment
Question by:Gary
7 Comments
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18796472
Does IUSR_machinename have write access to the folder?
0
 
LVL 25

Expert Comment

by:kevp75
ID: 18796683
you also made need to see if the file is read-only...

I wonder if there is a flag to do the overwrite....
0
 
LVL 58

Author Comment

by:Gary
ID: 18801088
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#
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 58

Author Comment

by:Gary
ID: 18801355
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.
0
 
LVL 58

Author Comment

by:Gary
ID: 18801403
Ahh solved it, wasnt disposing of
i = System.Drawing.Image.FromFile(strFilename)

:)
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19279638
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to refer to value 8 62
insert value of checklistbox checked 4 32
Weighted Randomizing 6 30
asp classic find word in string and get its value 4 15
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question