Ok I had to set this project aside and do something else, I'm back to this one and at this problem still.
Looking at the code you posted I converted it to vb. Like so
Try
If File1.PostedFile Is Nothing Then
Return
End If
Dim strFileName As String = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\") + 1)
Dim destUrl As String = SiteUrl + "/" + DocLibName + "/" + strFileName
Dim site As SPWeb = New SPSite(destUrl).OpenWeb()
site.AllowUnsafeUpdates = True
Dim fStream As Stream = File1.PostedFile.InputStream
Dim contents As Byte() = New Byte(fStream.Length - 1) {}
fStream.Read(contents, 0, CInt(fStream.Length))
fStream.Close()
site.Files.Add(destUrl, contents)
Catch ex As Exception
Response.Write("UploadDocFile ::" + ex.Message)
End Try
So I would put this data after
System.IO.File.Move(savePath, savePathMain & NewFileName)
I used this to rename the file..
My question is what is the File1.Postedfile mean?
Should I just change it to this
Dim strFileName As String = (savePathMain & NewFileName)