473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

File IO question with a web application

Hi I have a web application that uploads files to the server which is
working. A minor issue is that if the file already exists I get the error
file.doc already exists.
Just wondering if there is a way to have it automatically replace the file
and not produce the error?
thanks.
--
Paul G
Software engineer.
Jul 24 '08 #1
4 1049
hi,

first check if the file already exists or not...
if exists give the user option to choose between replace or not...
if user chooses replace delete the previous file and then upload the
file...

best of luck
Munna
Jul 24 '08 #2
Hi, thanks for the response. I will give it a try. I think the method you
have described will work well for my application as in some cases the file
path is just a path to a directory or a URL, so in those cases there are no
files to delete.
--
Paul G
Software engineer.
"Munna" wrote:
hi,

first check if the file already exists or not...
if exists give the user option to choose between replace or not...
if user chooses replace delete the previous file and then upload the
file...

best of luck
Munna
Jul 24 '08 #3
I recently dealt with this. I simply deleted the existing file.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:2E**********************************@microsof t.com...
Hi I have a web application that uploads files to the server which is
working. A minor issue is that if the file already exists I get the error
file.doc already exists.
Just wondering if there is a way to have it automatically replace the file
and not produce the error?
thanks.
--
Paul G
Software engineer.
Jul 25 '08 #4
ok, thanks for the additional information.
--
Paul G
Software engineer.
"Jonathan Wood" wrote:
I recently dealt with this. I simply deleted the existing file.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:2E**********************************@microsof t.com...
Hi I have a web application that uploads files to the server which is
working. A minor issue is that if the file already exists I get the error
file.doc already exists.
Just wondering if there is a way to have it automatically replace the file
and not produce the error?
thanks.
--
Paul G
Software engineer.

Jul 28 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jason Charalambides | last post by:
Hello, My question is: How do I get my application to start by double clicking on a file. I have made my application to save files with a specific extension. I associated those files to my...
2
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I...
1
by: santhosh_176 | last post by:
:I Created a Pocket PC application for iPAQ 5450. Every thing went fine even installer creation. I could run the setup and install it into the actual device and worked fine. The application enables...
4
by: grs | last post by:
Can a class library have a app.config file. Reason for asking is that the microsoft application blocks all read from myApp.exe.config. How can you use the application blocks if you do not have an...
8
by: Siu | last post by:
Hi, is it possible to sort a XML file without using a XSLT or XSL file?? For example, my XML is: <A> <1> <3> <4> <2> </A>
7
by: Lalasa | last post by:
Hi, Can anybody tell me how many cpu cycles File.copy would take and how many cpu cycles File.Move would take? CFile::Rename in C++ takes just one cpu cycle. As there is no File.Rename in C#,...
5
by: Neo | last post by:
Hello, I am receiving a file as a binary stream from a C++ Client Application. >From the application, the file is being sent as a "Multipart/form-data". I want to receive this file on the...
1
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.