欢迎光临
我们一直在努力

企业系统架构之思考-(速度篇)-ASP教程,ASP应用

建站超值云服务器,限时71元/月

上传文件

1.上传页面

<form name="form" action="upload.asp" method="post">

  <input type="submit" name="submit" value="ok">

<input type="file" name="file1" style="width:400" value="">

</form>

2.数据上传操做 (upload.asp) 页面

<% language=vbscript %>

<%

call upload

**********************************************************************

private function getfilename(byval strfile)

本函数用来取得上传文件名称

if strfile <> "" then

getfilename = mid(strfile,instrrev(strfile, "\")+1)

else

getfilename = ""

end if

end function

************************************************************************

private sub upload()

on error resume next

用来执行上传文件的代码

strfilename = request.form("file1")

set objstream = server.createobject("adodb.stream")

objstream.type = 1 adtypebinary

objstream.open

objstream.loadfromfile strfilename

保存文件到服务器

objstream.savetofile "d:\download\" & getfilename(strfilename),2

objstream.close

if err = 0 then

response.write "上传成功!"

else

response.write "上传失败!"

end if

set objstream = nothing

end sub

**************************************************************************

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 企业系统架构之思考-(速度篇)-ASP教程,ASP应用
分享到: 更多 (0)