test.asp

来自「用摄像头在线拍照片,上传到服务器,也可以自己画一个图片上传到服务器」· ASP 代码 · 共 38 行

ASP
38
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
session.CodePage=65001
Response.Buffer = True  
Response.ExpiresAbsolute = Now() - 1  
Response.Expires = 0  
Response.CacheControl = "no-cache"  
Response.AddHeader "Pragma", "No-Cache" 
Response.Charset="UTF-8"

Server.ScriptTimeout = 900

Function FormatName(FileExt)
	Dim RanNum
	Randomize
	RanNum = Int(90000*rnd)+10000
	FormatName = Year(now)&Month(now)&Day(now)&Hour(now)&Minute(now)&Second(now)&RanNum&FileExt
End Function


dim TotalBytes,Ads,filename
TotalBytes = Request.TotalBytes	
filename=FormatName(".jpg")

Set Ads = Server.CreateObject("Adodb." & "Stream")
With Ads
	.Type = 1
	.Open
	.Write request.BinaryRead(TotalBytes)
	.SaveToFile Server.MapPath("photo/"&filename), 2
	.Cancel()
	.Close()
End With
Set Ads=nothing

Response.write("success=OK&filename="&filename)
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?