A
Andrew Chan
Hi everyone,
I try to upload file by using asp.net, code like that:
<script language="VB" runat="server">
Sub Upload(Source As Object, e As EventArgs)
If Not (myFile.PostedFile Is Nothing) Then
Dim intFileNameLength as Integer
Dim strFileNamePath as String
Dim strFileNameOnly as String
'Logic to find the FileName (excluding the path)
strFileNamePath = MyFile.PostedFile.FileName
intFileNameLength = Instr(1, StrReverse(strFileNamePath), "\")
strFileNameOnly = Mid(strFileNamePath,
(Len(strFileNamePath)-intFileNameLength)+2)
myFile.PostedFile.SaveAs("c:\inetpub\wwwroot\yourwebapp\upload\" &
strFileNameOnly)
lblMsg.Text = "File Upload Success."
lblFileContentType.Text = "Content type: " &
MyFile.PostedFile.ContentType
lblFileSize.Text = "File size: " & CStr(MyFile.PostedFile.ContentLength)
& " bytes"
End If
End Sub
</script>
It is OK with uploading english named file, but not in chinese named files.
Any one can help me to solve this problem.
Many Thanks,
Andrew
I try to upload file by using asp.net, code like that:
<script language="VB" runat="server">
Sub Upload(Source As Object, e As EventArgs)
If Not (myFile.PostedFile Is Nothing) Then
Dim intFileNameLength as Integer
Dim strFileNamePath as String
Dim strFileNameOnly as String
'Logic to find the FileName (excluding the path)
strFileNamePath = MyFile.PostedFile.FileName
intFileNameLength = Instr(1, StrReverse(strFileNamePath), "\")
strFileNameOnly = Mid(strFileNamePath,
(Len(strFileNamePath)-intFileNameLength)+2)
myFile.PostedFile.SaveAs("c:\inetpub\wwwroot\yourwebapp\upload\" &
strFileNameOnly)
lblMsg.Text = "File Upload Success."
lblFileContentType.Text = "Content type: " &
MyFile.PostedFile.ContentType
lblFileSize.Text = "File size: " & CStr(MyFile.PostedFile.ContentLength)
& " bytes"
End If
End Sub
</script>
It is OK with uploading english named file, but not in chinese named files.
Any one can help me to solve this problem.
Many Thanks,
Andrew