无组件图文混合上传示例

2016-01-29 17:26 4 1 收藏

无组件图文混合上传示例,无组件图文混合上传示例

【 tulaoshi.com - ASP 】

  以下代码没有规范,还有些功能没完成,有那位高手能把它修改一下,封装成类则更是造福大众,或者以后有时间我会做的。有任何错误或建议请一定要给我发E-mail:sobina@21cn.com,谢谢。
  好了,少说多做,本示例在w2kServer,IIS5,SQL SERVER7中测试通过。
如有不明白的可到精华区查“图象”或“图片”关键字找到答案,或写信给我。
  示例一共有三个文件:upload.htm(上传界面)
process.asp(处理程序)
showimg.asp(显示图象)
数据库:在pubs数据库中建立一个新表名为imgtest
字段名    类型   长度
----------------------------------------------
id int (自动编号)
img iamge
imginfo nchar 50

以下是三个文件的代码:

upload.htm
---------------------------------------------------------------------
<html
<head
<titleUntitled Document</title
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"
<style type="text/css"
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px;

border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt;

background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;

border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black

#000000; color: #0000FF}
--
</style
</head

<body bgcolor="#FFFFFF" text="#000000"
<form name="form1" method="post" action="process.asp" enctype="multipart/form-data"
<table width="71%" border="1" cellspacing="0" cellpadding="5" align="center"

bordercolordark="#CCCCCC" bordercolorlight="#000000"
<tr bgcolor="#CCCCCC"
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC" Sobina
的图文上传界面</td
</tr
<tr align="left" valign="middle" bgcolor="#eeeeee"
<td bgcolor="#eeeeee" <br
</td
</tr
<tr align="center" valign="middle"
<td align="left" id="upid" height="122"
<p图象路径:
<input type="file" name="img" style="width:400" class="tx1" value=""
</p
<p图象说明:
<input type="text" name="imginfo"
</p
</td
</tr
<tr align="center" valign="middle" bgcolor="#eeeeee"
<td bgcolor="#eeeeee" height="2"
<input type="submit" name="Submit" value="· 提交 ·" class="bt"
<input type="reset" name="Submit2" value="· 重置 ·" class="bt"
</td
</tr
</table
</form
</body
</html
------------------------------------------------------------------------
process.asp
------------------------------------------------------------------------
<!--#include file="../bin/strCnn.asp"--
<%
response.expires=0
'目的:将二进制字符转换成普通字符
Function bin2str(binstr)
Dim varlen,clow,ccc,skipflag
skipflag=0
ccc = ""
varlen=LenB(binstr)
For i=1 To varlen
If skipflag=0 Then
clow = MidB(binstr,i,1)
If AscB(clow) 127 Then
ccc =ccc & Chr(AscW(MidB(binstr,i+1,1) & clow))
skipflag=1
Else
ccc = ccc & Chr(AscB(clow))
End If
Else
skipflag=0
End I

来源:https://www.tulaoshi.com/n/20160129/1501382.html

延伸阅读
标签: ASP
  以前,如果要用ASP操作文件,比如移动、复制、删除或者创建一个记事本文件,基本上都是通过FILESYSTEMOBJECT对象做的,当然,这个东西很专业,也没说什么不好,它可以提供完善的文件信息,比如建立时间,大小,上次修改时间等等,但是如果你不做痛苦的高代价的字符格式转换的话,利用它你无法直接操作二进制文件。 但是,现在我们介绍...
标签: Web开发
网上有不少生成缩略图的ASP组件。若你的虚拟空间不支持注册新组件,可能会感觉自己的网站失色不少。心晴不才,结合网上资源写了个无组件生成缩略图程序,仅供参考。 还是先看看基础部分吧。首先,我们知道在页面中显示图片是如下代码: img src="pic.gif" border="0" width="300" height="260" src是图片路径,borde...
标签: ASP
ASP 组件 FILE对象 当前,基于浏览器/服务器模式的应用比较流行。当用户需要将文件传输到服务器上时,常用方法之一是运行FTP服务器并将每个用户的FTP默认目录设为用户的Web主目录,这样用户就能运行FTP客户程序并上传文件到指定的 Web目录。这就要求用户必须懂得如何使用FTP客户程序。因此,这种解决方案仅对熟悉FTP且富有经验的用...
标签: ASP
  Call Com_CreatValidCode("ValidCode") Sub Com_CreatValidCode(pSN) 'Author: Layen 'QQ: 84815733 'E-mail: support@ssaw.net ' 禁止缓存 Response.Expires = -9999 Response.AddHeader "Pragma","no-cache" Response.AddHeader "cache-ctrol","no-cache" Response.ContentType = "Image/BMP" Randomize Dim i, ii, iii Const...
标签: ASP
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' CreateLyrics ' 目的: ' 在文件夹中创建两个文本文件。 ' 示范下面的内容 '  - FileSystemObject.CreateTextFile '  - TextStream.WriteLine '  - TextStream.Write '  - TextStream.WriteBlankLines ' &n...

经验教程

844

收藏

51
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部