Hi,
I am writing an upload program for clients to upload their files to
the server. I can successfully upload files by using <input type=file runat=server>
on client side and using C# programs to control on the
server side. This is the program I have written.

<html>
<head>

<script language="C#" runat="server">

void Button1_Click(object Source, EventArgs e)
{

if (Text1.Value == "")
{
Span1.InnerHtml = "Error: you must enter a file name";
return;
}

if (File1.PostedFile != null)
{
try
{
File1.PostedFile.SaveAs("c:\\temp\\"+Text1.Value);
Span1.InnerHtml = "File uploaded successfully to <b>c:\\temp\\"
+ Text1.Value + "</b> on the Web server";
}
catch (Exception exc)
{
Span1.InnerHtml = "Error saving file <b>c:\\temp\\" +
Text1.Value + "</b><br>" + exc.ToString();
}
}
}

</script>

</head>
<body>

<h3>HtmlInputFile Sample</h3>

<form enctype="multipart/form-data" runat="server">

Select File to Upload:
<input id="File1"
type="file"
maxlength="30"
runat="server"/>

<p>
Save as filename (no path):
<input id="Text1"
type="text"
runat="server"/>

<p>
<span id="Span1"
style="font: 8pt verdana;"
runat="server" />

<p>
<input type="button"
id="Button1"
value="Upload"
OnServerClick="Button1_Click"
runat="server">

</form>

</body>
</html>

Now, I want to enhance my program to check if there is an existing file
in the server that have the same name as the file the client side is going
to upload. I want to warn the user that he/she might be overwriting a file
in the server and ask him/her to choose if overwriting should be occurred.
If the user answers "yes", I want my program upload the file (it should "remember"
which file the user was entered before). I have tried to set the PostedFile
property. However, this is a "read-only" property and I cannot overwrite
it. Thanks for your help.

Winnie