| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 442 人关注过本帖
标题:图片上传
只看楼主 加入收藏
piwei8193
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2005-12-18
收藏
 问题点数:0 回复次数:1 
图片上传

我想要一个用asp做的简单的图片上传程序,网上的下的太难读了
哪位能帮帮忙咯
谢谢了

2005-12-22 23:55
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8078
专家分:6657
注 册:2005-11-7
收藏
得分:0 
这是up.htm文件



点上传时调uploadsave.asp


以下是uploadsave.asp文件
<% set upload=new upload_5xsoft set file=upload.file("MarkPicture") if file.fileSize>0 then '自动生成文件名 filename=date() filename=filename&time() filename=replace(filename,"-","") filename=replace(filename,":","") filename=replace(filename," ","") filename=filename+"." filenameend=file.filename filenameend=split(filenameend,".") if filenameend(1)="gif" or filenameend(1)="jpg" then filename=filename&filenameend(1) file.saveAs Server.mappath("../img/pic/"&filename) 'file.saveAs Server.mappath("/equipment/ad/reding/pic/"&filename) 'response.Write(filename) 'response.End session("MarkPicture") = filename response.write filename response.write "已上传成功!" 'response.write "
" |返回| 'response.write "" ' response.write "http://active.broadcast.hc360.com/equipment/ad/reding/pic/"&filename 'response.write "

|返回|" else response.write "文件格式不对|返回|" 'response.write "

|返回|" end if set file=nothing else response.write "文件内容不能为空|返回|" ' response.write "

|返回|" end if set upload=nothing response.write "
" %>

程序代码:
<SCRIPT language=javascript>

<% set upload=new upload_5xsoft set file=upload.file(\"MarkPicture\") if file.fileSize>0 then '自动生成文件名 filename=date() filename=filename&time() filename=replace(filename,\"-\",\"\") filename=replace(filename,\":\",\"\") filename=replace(filename,\" \",\"\") filename=filename+\".\" filenameend=file.filename filenameend=split(filenameend,\".\") if filenameend(1)=\"gif\" or filenameend(1)=\"jpg\" then filename=filename&filenameend(1) file.saveAs Server.mappath(\"../img/pic/\"&filename) 'file.saveAs Server.mappath(\"/equipment/ad/reding/pic/\"&filename) 'response.Write(filename) 'response.End session(\"MarkPicture\") = filename response.write filename response.write \"已上传成功!\" 'response.write \"
\" |返回| 'response.write \"\" ' response.write \"http://active.broadcast.hc360.com/equipment/ad/reding/pic/\"&filename 'response.write \"

|返回|\" else response.write \"文件格式不对|返回|\" 'response.write \"

|返回|\" end if set file=nothing else response.write \"文件内容不能为空|返回|\" ' response.write \"

|返回|\" end if set upload=nothing response.write \"
\" %> <% set upload=new upload_5xsoft set file=upload.file(\"MarkPicture\") if file.fileSize>0 then '自动生成文件名 filename=date() filename=filename&time() filename=replace(filename,\"-\",\"\") filename=replace(filename,\":\",\"\") filename=replace(filename,\" \",\"\") filename=filename+\".\" filenameend=file.filename filenameend=split(filenameend,\".\") if filenameend(1)=\"gif\" or filenameend(1)=\"jpg\" then filename=filename&filenameend(1) file.saveAs Server.mappath(\"../img/pic/\"&filename) 'file.saveAs Server.mappath(\"/equipment/ad/reding/pic/\"&filename) 'response.Write(filename) 'response.End session(\"MarkPicture\") = filename response.write filename response.write \"已上传成功!\" 'response.write \"
\" |返回| 'response.write \"\" ' response.write \"http://active.broadcast.hc360.com/equipment/ad/reding/pic/\"&filename 'response.write \"

|返回|\" else response.write \"文件格式不对|返回|\" 'response.write \"

|返回|\" end if set file=nothing else response.write \"文件内容不能为空|返回|\" ' response.write \"

|返回|\" end if set upload=nothing response.write \"
\" %> <% set upload=new upload_5xsoft set file=upload.file(\"MarkPicture\") if file.fileSize>0 then '自动生成文件名 filename=date() filename=filename&time() filename=replace(filename,\"-\",\"\") filename=replace(filename,\":\",\"\") filename=replace(filename,\" \",\"\") filename=filename+\".\" filenameend=file.filename filenameend=split(filenameend,\".\") if filenameend(1)=\"gif\" or filenameend(1)=\"jpg\" then filename=filename&filenameend(1) file.saveAs Server.mappath(\"../img/pic/\"&filename) 'file.saveAs Server.mappath(\"/equipment/ad/reding/pic/\"&filename) 'response.Write(filename) 'response.End session(\"MarkPicture\") = filename response.write filename response.write \"已上传成功!\" 'response.write \"
\" |返回| 'response.write \"\" ' response.write \"http://active.broadcast.hc360.com/equipment/ad/reding/pic/\"&filename 'response.write \"

|返回|\" else response.write \"文件格式不对|返回|\" 'response.write \"

|返回|\" end if set file=nothing else response.write \"文件内容不能为空|返回|\" ' response.write \"

|返回|\" end if set upload=nothing response.write \"
\" %> <% set upload=new upload_5xsoft set file=upload.file(\"MarkPicture\") if file.fileSize>0 then '自动生成文件名 filename=date() filename=filename&time() filename=replace(filename,\"-\",\"\") filename=replace(filename,\":\",\"\") filename=replace(filename,\" \",\"\") filename=filename+\".\" filenameend=file.filename filenameend=split(filenameend,\".\") if filenameend(1)=\"gif\" or filenameend(1)=\"jpg\" then filename=filename&filenameend(1) file.saveAs Server.mappath(\"../img/pic/\"&filename) 'file.saveAs Server.mappath(\"/equipment/ad/reding/pic/\"&filename) 'response.Write(filename) 'response.End session(\"MarkPicture\") = filename response.write filename response.write \"已上传成功!\" 'response.write \"
\" |返回| 'response.write \"\" ' response.write \"http://active.broadcast.hc360.com/equipment/ad/reding/pic/\"&filename 'response.write \"

|返回|\" else response.write \"文件格式不对|返回|\" 'response.write \"

|返回|\" end if set file=nothing else response.write \"文件内容不能为空|返回|\" ' response.write \"

|返回|\" end if set upload=nothing response.write \"
\" %>
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035320 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved