⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postimage.asp

📁 我们提供的VideoIM手机自动拍照上传器J2ME版本[开源]就是这么一种概念: 一个可以下载到手机(例如Nokia7610已经确实可以下载安装并正常运行)的Java应用程序
💻 ASP
字号:
<%
	On error Resume Next
	Dim Tracer
	set Tracer = server.CreateObject("PipeTrace.tracer")
	
	Dim strImageFileName
	strImageFileName = Request.QueryString("user")
	if strImageFileName = null then
		strImageFileName = Request.Form("user")
	end if
	
	Dim strImageCID
	strImageCID = Request.QueryString("cid")
	if strImageCID = null then
		strImageCID = Request.Form("cid")
	end if
	
	Dim strImageType
	strImageType = Request.QueryString("type")
	if strImageType = null then
		strImageType = Request.Form("type")
	end if
	
	if len(strImageFileName) < 1 then
		fullpath = "d:\Inetpub\wwwroot\j2me\uploadImage.bmp"
	else
		fullpath = "d:\Inetpub\wwwroot\j2me\" & strImageFileName & strImageCID & "." & strImageType
	end if 
	
	filesize = Request.TotalBytes 
	Tracer.Trace "收到了数据包,大小为:" & filesize
	'Response.End

	'获得上传文件的大小
	filedata = Request.BinaryRead(filesize) 
	'获得上传文件的二进制数据
	'Response.BinaryWrite filedata '在浏览器上显示二进制数据


	set reader = server.CreateObject("ADODB.Stream")
	 'reader为源数据流
	 reader.Mode = 3
	'设置打开模式,3为可读可写
	reader.Type=1 
	'设置数据类型,1为二进制数据
	reader.Open 

	set writer = server.CreateObject("ADODB.Stream")
	 'writer为目标数据流
	 writer.Mode=3 
	'设置打开模式,3为可读可写
	writer.Type=1 
	'设置数据类型,1为二进制数据
	writer.Open 
	On Error Goto 0

	On Error Resume Next
	Dim bIsExistIamgeFile
	reader.LoadFromFile fullpath
	if Err.number <> 0 then
		Tracer.Trace  "Load File Error:" & err.Description & "+" & err.number 
		bIsExistIamgeFile = false
	else
		Dim lFileSize
		lFileSize = reader.Size
		Tracer.Trace "上次一次保存的数据包大小为:" & lFileSize
		bIsExistIamgeFile = true

		if lFileSize > 0 then
			writer.Write reader.Read(lFileSize)
			writer.SetEOS 
		end if
	end if

	On Error Goto 0

	On Error Resume Next
	if(filesize > 0) then
		writer.Write filedata ' 赋值源数据流
		Tracer.Trace  "Have Data:" ' & SimpleBinaryToString(filedata)
	end if
	Tracer.Trace "保存文件为:" & fullpath

	' 以fullpath指定的路径及名称保存文件
	if bIsExistIamgeFile then
		writer.SaveToFile fullpath, 2
	else
		writer.SaveToFile fullpath, 1 
	end if
	 
	if Err.number <> 0 then
		Tracer.Trace  "Write File Error:" & err.Description & "+" & err.number 
	end if

	writer.Close 
	Set writer = nothing
	reader.Close 
	Set reader = nothing
	Set Tracer = nothing
	On Error Goto 0

	Function SimpleBinaryToString(Binary)
	  'SimpleBinaryToString converts binary data (VT_UI1 | VT_ARRAY Or MultiByte string)
	  'to a string (BSTR) using MultiByte VBS functions
	  Dim I, S
	  For I = 1 To LenB(Binary)
	    S = S & Chr(AscB(MidB(Binary, I, 1)))
	  Next
	  SimpleBinaryToString = S
	End Function
%>

⌨️ 快捷键说明

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