【问题标题】:Pure ASP upload with utf-8 filenames使用 utf-8 文件名的纯 ASP 上传
【发布时间】:2014-03-27 10:48:53
【问题描述】:

我已经用经典的 asp 制作了一个上传页面,只要文件名不是 utf-8 字符,它就可以正常工作。我已经添加了字符集直到页面并且表单接受 utf-8 字符但我的文件保存为Доклад Региона.pdf 错误应该是Доклад Региона.pdf

我不知道是否还有什么我可以做的,或者它是不支持 utf-8 字符的“纯 ASP 文件上传”。 有大神怎么解决吗?

我的asp页面是这样的

<% 
Response.CodePage = 65001 
Response.CharSet = "utf-8" 

'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><!--#INCLUDE FILE="upload2.asp"--><% 
dim File


DestinationPath = Server.mapPath("Files")
If Form.State = 0 Then 'Completted
    For Each File In Form.Files.Items
        If Len(File.FileName) > 0 Then
            Form.Files.Save DestinationPath 
        End If
    Next
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Project Site</title>
<link id="ss__cs" rel="stylesheet" href="CSS/stylesheet.css" type="text/css"/>
</head>
<body style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; padding: 0;" >

<form method="POST" id="myform" ENCTYPE="multipart/form-data" acceptcharset="UTF-8">
<table>
    <tr>
        <td>File</td>
        <td><input type="file" id="File1" name="File1" class="defaultfont"></td>    
    </tr>
    <tr height="10">

    </tr>
    <tr>
        <td></td>
        <td><input Value="Cancel" Type="button" class="defaultfont" onclick="window.close()">&nbsp;&nbsp;&nbsp;<input Value="Upload file" Type="submit" class="defaultfont" ></td>    
    </tr>
</table>

</Form>

</body>
</html>

【问题讨论】:

    标签: utf-8 asp-classic upload filenames


    【解决方案1】:

    尝试添加

    If Form.State = 0 Then 'Completted
      'Add this line to set the character set based on the response.
      Form.CharSet = Response.CharSet
    

    欲了解更多信息,请参阅Upload - use unicode (utf-8) character set for request/response data

    【讨论】:

      猜你喜欢
      • 2016-03-24
      • 1970-01-01
      • 1970-01-01
      • 2013-06-04
      • 2018-09-21
      • 2013-12-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多