uploading of file to the server
Posted on 2003-10-28
I have tried this code and it works fine.
Select file to upload: <input id="uploadedFile" type="file" runat="server" NAME="uploadedFile">
Dim savePath As String = "C:\temp\"
Dim postedFile = uploadedFile.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
postedFile.SaveAs(savePath & filename)
but i will like to have a check such that when the user uploads a file to the temp directory. if there is already a file with the same name in the directory, prompt the user whether the user wants to overwrite the file. Also prompt the user when the file choosen is not found instead of creating an empty file in the server side.