Problems: uploading files have Chinese named files

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top