仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 409|回复: 8
打印 上一主题 下一主题

[学习教程] ASP网站制作之不必组件完成上载功效(2)

[复制链接]
爱飞 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:34:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
使用cdonts,可以发送、查看邮件,实现webmail的功能。结合wsh,可以实现对nt主机的管理,如nt用户管理、iis虚拟主机设置、exchange邮箱设置等等,就像管理本地机一样方便。----filename/handld_upload.asp

<%OptionExplicit%>

<%
Response.Expires=0
Response.Buffer=TRUE
Response.Clear
ConstIMAGE_SIZE="width=""200""height=""150"""
DimUploadRequest
SetUploadRequest=Server.CreateObject("Scripting.Dictionary")

DimbyteCount,RequestBin
byteCount=Request.TotalBytes
RequestBin=Request.BinaryRead(byteCount)

BuildUploadRequestRequestBin

DimsaveURL,goURL,filepathname,value,filename
----savepath
saveURL=UploadRequest.Item("saveURL").Item("Value")
saveURL="/"

----jumptofilepathwhenfinishupload
goURL=UploadRequest.Item("goURL").Item("Value")

filepathname=UploadRequest.Item("my_file").Item("FilePathName")
value=UploadRequest.Item("my_file").Item("Value")
filename=Right(filepathname,Len(filepathname)-InstrRev(filepathname,""))

----debug
Response.WritesaveURL&"**"&goURL&"**"&filepathname
Response.Write"**"&filename
Response.End

Dimfso,MyFile,i
Setfso=Server.CreateObject("Scripting.FileSystemObject")
IfNOTfso.FolderExists(Server.mappath(saveURL)&"")Then
RecMkDir(Server.mappath(saveURL)&"")
EndIf
SetMyFile=fso.CreateTextFile(Server.mappath(saveURL)&""&filename)

Fori=1toLenB(value)
MyFile.Writechr(AscB(MidB(value,i,1)))
Next

MyFile.Close

Session("StoredFile")=filename
Session("strImage")="</script>
<scriptlanguage="JavaScript">
<!--
functionUpLoad(obj)
{
if(obj.my_file.value.length<7)
returnfalse;
returntrue;
}
//-->
</script>
<bodylink=<%=COLOR_NL_1%>alink=<%=COLOR_AL_1%>vlink=<%=COLOR_VL_1%>bgcolor=<%=COLOR_BG_1%>>
<fontcolor="<%=C_WD_CONTENT_4%>">
Onlyupload<b>*.jpg</b>or<b>*.gif</b>file!
<br>
Otherwise,imagemaynotshowcorrectly!
</font>
<center>
<table>
<%If(Len(Session("strImage"))>0)Then%>
<tr>
<td>
<tableborder="1"bordercolor="<%=C_WD_T_BORDER%>"cellspacing="0"cellpadding="0"<%=IMAGE_SIZE%>>
<tr>
<td><%=Session("strImage")%></td>
</tr>
</table>
</td>
</tr>
<%Else%>
<tr>
<td>
<tableborder="1"bordercolor="<%=C_WD_T_BORDER%>"cellspacing="0"cellpadding="0">
<tr>
<tdalign="center"valign="top">
<tablecellspacing="0"cellpadding="0"border="0"<%=IMAGE_SIZE%>>
<tr>
<tdcolspan="2"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>"><b>Upload/previewimage:</b></font></td>
</tr>
<tr>
<tdcolspan="2"></td>
</tr>
<tr>
<tdvalign="top"nowrap><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>"><b>Step1:</b></font></td>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>">Prepareanimagewith72dpiresolution.</font></td>
</tr>
<tr>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>"><b>Step2:</b></font></td>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>">Selectyourimagefile</font></td>
</tr>
<tr>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>"><b>Step3:</b></font></td>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>">Press"Upload"button</font></td>
</tr>
<tr>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>"><b>Step4:</b></font></td>
<tdvalign="top"><fontclass="e-foot"color="<%=C_WD_CONTENT_4%>">Continue<b>OR</b>repeat<b>Step1-3</b>tochangetheimage</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<%EndIf%>
</table>
</center>

<formmethod="POST"enctype="multipart/form-data"action="handle_upload.asp"id=form1name=form1>
<inputtype="hidden"name="saveURL"value="<%=WEB_TEMP_PATH%>">
<inputtype="hidden"name="goURL"value="<%=Request.ServerVariables("PATH_INFO")%>">
<inputclass="btn"type="file"name="my_file">
<inputclass="btn"type="submit"name="submit"value="Upload">
</form>

<formaction="<%=thisFile%>"id=form2name=form2>
<inputclass="btn"type="submit"name="imageCancel"value="PressHereToCancelImage!">
<br><br>
<inputclass="btn"type="submit"value="Finish!"id=submit1name=submit1>
</form>
</body>
</html>
对于中小型web应用来说,php有很强的竞争力,linux+apache+mysql+php(lamp)的组合几乎可以胜任绝大多数网站的解决方案,对于大型应用来讲,对于系统架构要求更高,需要有成熟的框架支持,jsp的struts是个不错的框架,国内介绍它的资料也非常多,应用逐渐广泛起来。asp就不用说了,
乐观 该用户已被删除
沙发
发表于 2015-1-19 16:30:14 | 只看该作者
我想问如何掌握学习节奏(先学什么再学什么)最好详细点?
只想知道 该用户已被删除
板凳
发表于 2015-1-26 22:58:12 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
柔情似水 该用户已被删除
地板
发表于 2015-2-4 22:32:52 | 只看该作者
ASP也是这几种脚本语言中最简单易学的开发语言。但ASP也是这几种语言中唯一的一个不能很好支持跨平台的语言。  因为ASP脚本语言非常简单,因此其代码也简单易懂,结合HTML代码,可快速地完成网站的应用程序。
老尸 该用户已被删除
5#
发表于 2015-2-10 22:01:51 | 只看该作者
那么,ASP.Net有哪些改进呢?
愤怒的大鸟 该用户已被删除
6#
发表于 2015-3-1 16:27:27 | 只看该作者
Server:这个表示的服务器,操作服务器的一些东西使用这个,如Server.Mappath转换服务器路径,Server.CreateObject实例化一个组件
莫相离 该用户已被删除
7#
发表于 2015-3-10 20:38:02 | 只看该作者
不能只是将它停留在纸上谈兵的程度上。
若天明 该用户已被删除
8#
发表于 2015-3-17 09:54:06 | 只看该作者
兴趣爱好,那么你无须学编程,申请一个域名和空间,在网上下载一些免费开源的CMS系统,你不用改代码,只须熟悉它们的后台操作,像office一样简单方便,很快就能建一个站点,很多站长都是这样做的
兰色精灵 该用户已被删除
9#
发表于 2015-3-24 06:10:44 | 只看该作者
运用经典的例子。并且自己可以用他来实现一些简单的系统。如果可以对他进行进一步的修改,找出你觉得可以提高性能的地方,加上自己的设计,那就更上一个层次了,也就会真正地感到有所收获。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-10-1 21:24

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表