Back

windows - classic asp 上传文件2(纯文本,无法上传二进制)

发布时间: 2023-01-24 00:33:00

refer to:

网上找的基本都不好使。。。要么过时了,要么超级啰嗦无法验证

还是自己写一个简洁版吧: 只能上传 文字版文件:


<%
response.write("current path: " & server.mappath("/"))

If request("file_name") <> "" Then
  Set FSO = CreateObject("Scripting.FileSystemObject")

  file_name = request("file_name")
  file_extension = request("file_extension")

  ' change the new file's path here,  / is current path.
  path = server.mappath("/") & "/" & file_name & "." & file_extension
  response.write("path: " & path)
  Set File = FSO.CreateTextFile(path,True)
  File.Write request("file_content")
  File.Close
End If

%>
<form method=POST>
  file name: <input type="text" name="file_name" placeholder="e.g. my_page"/> <br/>
  file ext : <input type="text" name="file_extension" placeholder="e.g. asp"/> <br/>
  content: <br/>
  <textarea name="file_content" style='width: 300px; height: 200px'>
  </textarea> <br/>
  <input type="submit" value="submit" />
</form>

Back