Solved

Force file overwrite

Posted on 2007-03-26
7
774 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now