标题:求助,关于图片上传的问题。
只看楼主
gklm
Rank: 2
等 级:论坛游民
帖 子:4
专家分:10
注 册:2011-5-17
 问题点数:0 回复次数:0 
求助,关于图片上传的问题。
我快要晕了,弄了N多回,都没有成功,老是不对,所以上来请位哥哥帮忙,小弟在此先谢谢了。
是这样子的,我有页面表单,要上传头像,可是我在网上找了很多代码都不能成功,有时候搞对了,可以上传图片了,可是上传图片后,显示不了,数据库里没有地址,空的,也显示不了。很是郁闷。我也在网上找了很多资料,可是怎么弄都不,要不就是上传图片成功了,而在数据里即另起一行数据了。我是一名新手,刚刚才学。不太懂,都靠自己在网搜资料慢慢学的,真的无奈之下,没有办法,所以上来耽搁大家求助哥哥们帮忙。谢谢!


红色为图片上传部分  蓝色为图片更改部分
<!--#include file="inc/right.asp"-->
<!--#include file="inc/conn.asp"-->
<%
IF Request("wor")="del" Then
sql="delete from Information where id="&Request("id")
Conn.execute(sql)
Response.Redirect "?action=list"
End IF
%>

<%
action=Request("action")
id=Request("id")
if action="yes" Then
 set rs=server.createobject("adodb.recordset")
if id="" then
   set rsCheck = conn.execute("select dabh from Information where dabh='" & trim(Request.Form("dabh")) & "'")
     if not (rsCheck.bof and rsCheck.eof) then
      response.write "<script language='javascript'>alert('档案编号 " & trim(Request.Form("dabh")) & " 已存在,请检查!');history.back(-1);</script>"
      response.end
     end if
   set rsCheck=nothing
   sql="select * from Information"
   rs.open sql,conn,3,3
   rs.addnew         '添加记录到数据表末端
else
   sql="select * from Information where id="&id&""
   rs.open sql,conn,1,2
end if
rs("dabh")=Request("dabh")
rs("spec")=Request("spec")
rs("bpic")=Request("bpic")
rs("name")=Request("name")
rs("name1")=Request("name1")
rs("mz")=Request("mz")
rs("sfz")=Request("sfz")
rs("lxfs")=Request("lxfs")
rs("fzlx")=Request("fzlx")
rs("lf")=Request("lf")
rs("fjdz")=Request("fjdz")
rs("xjzdz")=Request("xjzdz")
rs("flws")=Request("flws")
rs("xlbm")=Request("xlbm")
rs("zzfx")=Request("zzfx")
rs("fxcs")=Request("fxcs")
rs("sqkf")=Request("sqkf")
rs("wf")=Request("wf")
rs("addtime")=Request("addtime")
 rs.update         '更新数据表记录
 rs.close
set rs=nothing
 Response.Redirect "?action=list"
end if
%>
<html>
<head>
<title>XXXXXX社区管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/main.css" rel="stylesheet" type="text/css">
<script language=JavaScript>
<!--
function DoEmpty(params)
{
if (confirm("真的要删除这条记录吗?删除后此记录里的所有内容都将被删除并且无法恢复!"))
window.location = params ;
}

function check()
{

  if (document.add.dabh.value=="")
     {
      alert("请填写档案编号!")
      document.add.dabh.focus()
      document.add.dabh.select()
      return
     }
     
  if (document.add.name.value=="")
     {
      alert("请填写姓名!")
      document.add.name.focus()
      document.add.name.select()
      return
     }
     
  if (document.add.name1.value=="")
     {
      alert("请填写别名!")
      document.add.name1.focus()
      document.add.name1.select()
      return
     }
     
       if (document.add.mz.value=="")
     {
      alert("请填写民族!")
      document.add.mz.focus()
      document.add.mz.select()
      return
     }
       if (document.add.sfz.value=="")
     {
      alert("请填写身份证!")
      document.add.sfz.focus()
      document.add.sfz.select()
      return
     }
       if (document.add.lxfs.value=="")
     {
      alert("请填写联系方式!")
      document.add.lxfs.focus()
      document.add.lxfs.select()
      return
     }
       if (document.add.fzlx.value=="")
     {
      alert("请填写XX类型!")
      document.add.fzlx.focus()
      document.add.fzlx.select()
      return
     }
       if (document.add.lf.value=="")
     {
      alert("请填写是否XX!")
      document.add.lf.focus()
      document.add.lf.select()
      return
     }
       if (document.add.fjdz.value=="")
     {
      alert("请填写户籍地址!")
      document.add.fjdz.focus()
      document.add.fjdz.select()
      return
     }
       if (document.add.xjzdz.value=="")
     {
      alert("请填写现居住地址!")
      document.add.xjzdz.focus()
      document.add.xjzdz.select()
      return
     }
        if (document.add.flws.value=="")
     {
      alert("请填写XX!")
      document.add.flws.focus()
      document.add.flws.select()
      return
     }
       if (document.add.xlbm.value=="")
     {
      alert("请填写下落不明!")
      document.add.xlbm.focus()
      document.add.xlbm.select()
      return
     }
       if (document.add.zzfx.value=="")
     {
      alert("请填写正在XX!")
      document.add.zzfx.focus()
      document.add.zzfx.select()
      return
     }
       if (document.add.fxcs.value=="")
     {
      alert("请填写XX!")
      document.add.fxcs.focus()
      document.add.fxcs.select()
      return
     }
       if (document.add.sqkf.value=="")
     {
      alert("请填写XX!")
      document.add.sqkf.focus()
      document.add.sqkf.select()
      return
     }
       if (document.add.wf.value=="")
     {
      alert("请填写XXX!")
      document.add.wf.focus()
      document.add.wf.select()
      return
     }
     
  if (document.add.addtime.value=="")
     {
      alert("请填写XX时间!")
      document.add.addtime.focus()
      document.add.addtime.select()
      return
     }
     
     document.add.submit()
}

 function changeN()
 {
  add.spec.disabled=true;
 }
 function changeY()
 {
  add.spec.disabled=false;
 }
 function next()
 {
  if(event.keyCode==13)event.keyCode=9;
 }
-->
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td bgcolor="#FFFFFF">
    <%if action="add" then%><BR>
        <table width="96%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
        <form name="add" method="post" action="Information.asp">
        <tr align="center" bgcolor="#F2FDFF">
          <td colspan="2"  class="optiontitle"> 添加信息 </td>
        </tr>
        <tr align="center" bgcolor="#F2FDFF">
          <td width="15%" align="right">档案编号:</td>
          <td width="85%" align="left"><input name="dabh" type="text" id="dabh" onKeyDown="next()" >
          按回车\TAB键即可输入下一选项</td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td rowspan="2" align='right' bgcolor="#FFFFFF">照片:</td>
          <td align='left'><input name="bpic" type="text" class="ct_box1" id="bpic" size="80" /></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='left'><iframe frmAnnounce='ad' frameborder=0 width='80%' height=24 scrolling=no src='sm_upload.asp?action=bpic'></iframe></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">姓名:</td>
          <td align='left'><input name="name" type="text" id="name" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">别名:</td>
          <td align='left'><input name="name1" type="text" id="name1" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">民族:</td>
          <td align='left'><input name="mz" type="text" id="mz" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">身份证:</td>
          <td align='left'><input name="sfz" type="text" id="sfz" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">法律文书:</td>
          <td align='left'><input name="flws" type="text" id="flws" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">联系方式:</td>
          <td align='left'><input name="lxfs" type="text" id="lxfs" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> XXXXX:</td>
          <td align='left'>
            <input type="radio" name="fzlx" value="XXXX" onClick="changeN()">
            未XX            <input type="radio" name="fzlx" value="XXXXX" onClick="changeY()" checked="checked">
            XXXX            <%
              Set rsspec = Server.CreateObject("ADODB.Recordset")
            rsspec.open "select * from Specialty",Conn,1,2
            if rsspec.eof and rsspec.bof then
            response.write "请先添加XXX"
            else
          %>
            <select name="spec" id="spec">
              <option value="">请选择犯XXXX</option>
          <%
            do while not rsspec.eof
          %>
             <option value="<%=rsspec("title")%>"><%=rsspec("title")%></option>
          <%
            rsspec.movenext
            loop
            end if
            rsspec.close
            set rsspec=nothing
          %>
            </select>
          </td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">是否XX:</td>
          <td align='left'><input name="lf" type="text" id="lf" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">下落不明:</td>
          <td align='left'><input name="xlbm" type="text" id="xlbm" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">正在XX:</td>
          <td align='left'><input name="zzfx" type="text" id="zzfx" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXXX:</td>
          <td align='left'><input name="fxcs" type="text" id="fxcs" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXXX:</td>
          <td align='left'><input name="sqkf" type="text" id="sqkf" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">户籍地址:</td>
          <td align='left'><input name="fjdz" type="text" id="fjdz" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">现居住地址:</td>
          <td align='left'><input name="xjzdz" type="text" id="xjzdz" onKeyDown="next()" ></td>
        </tr>
                <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXX事实:</td>
          <td align='left'><input name="wf" type="text" id="wf" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> XXX时间:</td>
          <td align='left'><input name="addtime" type="text" id="addtime" value="<%response.write now()%>" onKeyDown="next()" ></td>
        </tr>
        <tr align="center" bgcolor="#ebf0f7">
          <td  colspan="2" >
             <INPUT TYPE="hidden" name="action" value="yes">
            <input type="button" name="Submit" value="提交" onClick="check()">
              <input type="button" name="Submit2" value="返回" onClick="history.back(-1)"></td>
        </tr>
        </FORM>
      </table>
<%end if%>
<br>
<%if action="list" then%>
      <table width="96%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
        <tr align="center" bgcolor="#F2FDFF">
          <td colspan="6"  class="optiontitle">查询信息</td>
        </tr>
        <tr align="center">
          <td bgcolor="#ebf0f7" width="12%">档案编号</td>
          <td bgcolor="#ebf0f7" width="6%">姓名</td>
          <td bgcolor="#ebf0f7" width="15%">身份证</td>
          <td bgcolor="#ebf0f7" width="10%">联系电话</td>
          <td bgcolor="#ebf0f7" width="10%">XX文书</td>
          <td bgcolor="#ebf0f7" width="15%">XXX类型</td>
          <td bgcolor="#ebf0f7" width="12%">点击修改</td>
        </tr>
        
<%
sql="select * from Information order by id desc"
 set rs=server.createobject("adodb.recordset")
 rs.open sql,conn,1,1
 if not rs.eof then
 proCount=rs.recordcount
    rs.PageSize=20                      '定义显示数目
     if not IsEmpty(Request("ToPage")) then
        ToPage=CInt(Request("ToPage"))
        if ToPage>rs.PageCount then
           rs.AbsolutePage=rs.PageCount
           intCurPage=rs.PageCount
        elseif ToPage<=0 then
           rs.AbsolutePage=1
           intCurPage=1
        else
           rs.AbsolutePage=ToPage
           intCurPage=ToPage
        end if
     else
        rs.AbsolutePage=1
        intCurPage=1
     end if
     intCurPage=CInt(intCurPage)
     For i = 1 to rs.PageSize
     if rs.eof then     
     Exit For
     end if '利用for next 循环依次读出记录
%>
        <tr align='center' bgcolor='#FFFFFF' onmouseover='this.style.background="#F2FDFF"' onmouseout='this.style.background="#FFFFFF"'>
          <td><%=rs("dabh")%></td>
          <td><%=rs("name")%></td>
          <td><%=rs("sfz")%></td>
          <td><%=rs("lxfs")%></td>
          <td><%=rs("flws")%></td>
          <td><%=rs("fzlx")%></td>
          <td><IMG src="images/edit.gif" align="absmiddle"><a href="?action=edit&id=<%=rs("id")%>">修改</a> | <IMG src="images/drop.gif" align="absmiddle"><a href="javascript:DoEmpty('?wor=del&id=<%=rs("id")%>&action=list&ToPage=<%=intCurPage%>')">删除</a></td>
        </tr>
<%
rs.movenext
next
%>
        <tr align="center" bgcolor="#ebf0f7">
          <td colspan="6"> 总共:<font color="#ff0000"><%=rs.PageCount%></font>页, <font color="#ff0000"><%=proCount%></font>位XXXX, 当前页:<font color="#ff0000"><%=intCurPage%> </font><%if intCurPage<>1 then%><a href="?action=list">首页</a>|<a href="?action=list&ToPage=<%=intCurPage-1%>">上一页</a>|<% end if
if intCurPage<>rs.PageCount then %><a href="?action=list&ToPage=<%=intCurPage+1%>">下一页</a>|<a href="?action=list&ToPage=<%=rs.PageCount%>"> 最后页</a><% end if%></span></td>
        </tr>
<%
else
%>
        <tr align="center" bgcolor="#ffffff">
          <td colspan="6">对不起!目前数据库中还没有添加录取考生信息!</td>
        </tr>
<%
rs.close
set rs=nothing
end if
%>
      </table>
      <br>
<%end if%>
<%if action="edit" then
set rs=server.createobject("adodb.recordset")
sql="select * from Information where id="&Request("id")
rs.open sql,conn,1,1
if not rs.eof Then
%>
<br>
      <table width="96%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
       <form name="add" method="post" action="Information.asp">
        <tr align="center" bgcolor="#F2FDFF">
          <td colspan=2  class="optiontitle"> XX信息 </td>
        </tr>
        <tr align="center" bgcolor="#F2FDFF">
          <td width="18%" align="right"> 档案编号:</td>
          <td width="82%" align="left"><input name="dabh" type="text" id="dabh" value="<%=rs("dabh")%>" onKeyDown="next()" >
            按回车\TAB键即可输入下一选项</td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td rowspan="3" align='right' bgcolor="#FFFFFF">照片:</td>
          <td align='left'><img src="<%=rs("bpic")%>"></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='left'><input name="bpic" type="text" class="ct_box1" id="bpic" value="<%=rs("bpic")%>" size="80" /></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='left'>&nbsp;<iframe name='ad' frameborder=0 width='80%' height=24 scrolling=no src='sm_upload.asp?action=bpic'></iframe></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> 姓名:</td>
          <td align='left'><input name="name" type="text" id="name" value="<%=rs("name")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">别名:</td>
          <td align='left'><input name="name1" type="text" id="name1" value="<%=rs("name1")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> 民族:</td>
          <td align='left'><input name="mz" type="text" id="mz" value="<%=rs("mz")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">身份证:</td>
          <td align='left'><input name="sfz" type="text" id="sfz" value="<%=rs("sfz")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXX文书:</td>
          <td align='left'><input name="flws" type="text" id="flws" value="<%=rs("flws")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">联系电话:</td>
          <td align='left'><input name="lxfs" type="text" id="lxfs" value="<%=rs("lxfs")%>" onKeyDown="next()" ></td>
         </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> 是否XXX:</td>
          <td align='left'>
            <input type="radio" name="fzlx" value="XXX人员" onClick="changeN()" <% if rs("fzlx")="XXX人员" then response.Write("checked") end if%>>未XXX            <input type="radio" name="fzlx" value="XXX人口" onClick="changeY()" <% if rs("fzlx")="XXX人口" then response.Write("checked") end if%>>XXXXX
            <%
              Set rsspec = Server.CreateObject("ADODB.Recordset")
            rsspec.open "select * from Specialty",Conn,1,2
            if rsspec.eof and rsspec.bof then
            response.write "请先添加专业"
            else
          %>
            <select name="spec" id="spec" disabled>
              <option value="">请选择专业</option>
          <%
            do while not rsspec.eof
          %>
           <option value="<%=rsspec("title")%>" selected <% if rs("spec")=rsspec("title") then response.write("selected") end if%>><%=rsspec("title")%></option>
          <%
            rsspec.movenext
            loop
            end if
            rsspec.close
            set rsspec=nothing
          %>
            </select>         
          </td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">是否XXX:</td>
          <td align='left'><input name="lf" type="text" id="lf" value="<%=rs("lf")%>" onKeyDown="next()" ></td>
        </tr><tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">下落不明:</td>
          <td align='left'><input name="xlbm" type="text" id="xlbm" value="<%=rs("xlbm")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">正在XXX:</td>
          <td align='left'><input name="zzfx" type="text" id="zzfx" value="<%=rs("zzfx")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXX场所:</td>
          <td align='left'><input name="fxcs" type="text" id="fxcs" value="<%=rs("fxcs")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXX:</td>
          <td align='left'><input name="sqkf" type="text" id="sqkf" value="<%=rs("sqkf")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">户籍地址:</td>
          <td align='left'><input name="fjdz" type="text" id="fjdz" value="<%=rs("fjdz")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">现居住地址:</td>
          <td align='left'><input name="xjzdz" type="text" id="xjzdz" value="<%=rs("xjzdz")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF">XXX事实:</td>
          <td align='left'><input name="wf" type="text" id="wf" value="<%=rs("wf")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align='center' bgcolor='#FFFFFF'>
          <td align='right' bgcolor="#FFFFFF"> XXX时间:</td>
          <td align='left'><input name="addtime" type="text" id="addtime" value="<%=rs("addtime")%>" onKeyDown="next()" ></td>
        </tr>
        <tr align="center" bgcolor="#ebf0f7">
          <td colspan="2">
          <input type="hidden" name="action" value="yes">
          <input type="button" name="Submit2" value="提交" onClick="check()">
          <input type="button" name="Submit2" value="返回" onClick="history.back(-1)">
          <input name="id" type="hidden" id="id" value="<%=rs("id")%>">          </td>
        </tr>
          </FORM>
      </table>
<%
end if
end if
%>   
    </td>
  </tr>
</table>
</body>
</html>







搜索更多相关主题的帖子: 图片 哥哥 网上 资料 
2011-05-17 19:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-340205-1-1.html




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

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