i have a web page that allows you to upload a file to the server.
if i upload a word document so the sever, then modify the original document and try to upload it again, the file overwrite fails.
does anybody know why.
if i do the same with either a text file or pdf file, the
file overwrite succeeds.
here is the code i am using
<%@ Control Language="
vb" Inherits="dannet.uploadfile" %>
<%@ Import namespace = "System.IO" %>
<script runat =server >
public sub upload_click (obj as object , e as eventargs )
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
dim filepathname as string
filepathname = "./docs/" & filename
message.text = filepathname
postedFile.SaveAs(server.mapPath("./docs/") & filename)
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
end if
end sub
</script>
<table>
<tr><td>
Select File to Upload: <input id="uploadedFile" size="60" type="file" runat="server" NAME="uploadedFile">
<Input Type="submit" Value="Upload" OnServerClick="Upload_Click" RunAt="Server" ID="uploaddoc" >
</td></tr>
<tr><td><asp:Label ID = message text = "" Runat = server />
</td></tr>
</table>