回 帖 发 新 帖 刷新版面

主题:[讨论]哪位大侠帮解决上传问题.

原文件:one.asp
<%@language=vbscript codepage=936 %>
<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<!--#include file="Inc/Function.asp"-->
<!--#include FILE="inc/upload_5xsoft.inc"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%
call checkmanage("03")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
%>
<script language = "JavaScript">
function CheckForm()
{
if (editor.EditMode.checked==true)
    document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
    document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 

if (document.myform.Title.value=="")
{
alert("产品名称不能为空!");
    document.myform.Title.focus();
    return false;
}
if (document.myform.Product_Id.value=="")
{
alert("产品编号不能为空!");
    document.myform.Key.focus();
    return false;
}
if (document.myform.Key.value=="")
{
alert("关键字不能为空!");
    document.myform.Key.focus();
    return false;
}
if (document.myform.Content.value=="")
{
alert("产品介绍不能为空!");
    editor.HtmlEdit.focus();
    return false;
}
return true;
}
</script>
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr> 
<td align="center" valign="top" class=td>
<br>
<b>添 加 产 品</b><br>
<form action="ProductSave.asp" method="POST" enctype="multipart/form-data" name="myform" target="_self" onSubmit="return CheckForm();">
<table width="100%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr align="center"> 
<td class="tdbg"> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#666666">
<tr> 
<td width="150" height="22" align="right" >所属类别:</td>
<td bgcolor="#E3E3E3"> 
<%
sql = "select * from BigClass order by orderid"
rs.open sql,conn,1,1
        if rs.eof and rs.bof then
            response.write "请先添加栏目。"
        else
        %>
<select name="BigClassName"  size="1">
<option selected value="<%=trim(rs("BigClassID"))%>"><%=trim(rs("BigClassName"))%>/<%=trim(rs("BigClassName_en"))%></option>
<%
            dim selclass
        selclass=rs("BigClassName")
    rs.movenext
        do while not rs.eof
            %>
<option value="<%=trim(rs("BigClassID"))%>"><%=trim(rs("BigClassName"))%>/<%=trim(rs("BigClassName_en"))%></option>
<%
        rs.movenext
    loop
        end if
rs.close
            %>
</select> 
 </td>
</tr>
<tr> 
<td width="150" height="22" align="right" >产品编号:</td>
<td bgcolor="#E3E3E3"> <input name="Product_Id" type="text"
 id="Product_Id2" value="NO." size="10" maxlength="10"> <font color="#FF0000">*</font></td>
</tr>
<tr> 
<td width="150" height="22" align="right" >产品名称/英文:</td>
<td bgcolor="#E3E3E3"> <input name="Title" type="text"
 id="Title2" size="25" maxlength="40">/<input name="Title_en" type="text"
 id="Title2" size="25" maxlength="40"><font color="#FF0000">*</font></td>
</tr>
<tr> 
<td width="150" height="22" align="right" >产品图片:</td>
<td bgcolor="#E3E3E3"> 
                <input type="file" name="file" style="FONT-SIZE: 9pt; WIDTH: 250px" maxlength=50 size=30>
                (文件大小限制为200KB,文件格式(.jpg .gif),建议图片大小450×360)</td>
</tr>
<tr> 
<td width="150" height="22" align="right" >已通过审核:</td>
<td bgcolor="#E3E3E3"> <input name="Passed" type="checkbox" id="Passed2" value="yes" checked>
是<font color="#0000FF">(如果选中的话将直接发布)</font></td>
</tr>

<tr> 
<td height="22" align="right" bgcolor="#C0C0C0">特别推荐:</td>
<td bgcolor="#E3E3E3"><input name="Elite" type="checkbox" id="Passed" value="yes">
是<font color="#0000FF">(如果选中的话将在推荐栏目发布)</font></td>
</tr>
<tr> 
<td width="150" height="22" align="right" valign="middle" >产品说明:</td>
<td bgcolor="#E3E3E3"><strong>中文说明:</strong><br>
<textarea name="Content" style="display:none"></textarea>
<iframe ID="Editor" src="../webedit/ewebeditor.asp?id=content&style=standard" frameborder="0" scrolling="no" width="98%" HEIGHT="300"></iframe>
<br><br>
<strong>英文说明:</strong><br>
<textarea name="Content_en" style="display:none"></textarea>
<iframe ID="Editor2" src="../webedit/ewebeditor.asp?id=content_en&style=standard" frameborder="0" scrolling="no" width="98%" HEIGHT="300"></iframe>

</td>
</tr>
<tr> 
<td width="150" height="22" align="right" bgcolor="#C0C0C0">录入时间:</td>
<td bgcolor="#E3E3E3"> <input name="UpdateTime" type="text" id="UpdateTime2" value="<%=now()%>" maxlength="50">
当前时间为:<%=now()%> 注意不要改变格式。</td>
</tr>
</table></td>
</tr>
</table>
<div align="center"><p> 
<input name="Add" type="submit"id="Add" value=" 添 加 " onClick="document.myform.action='ProductSave.asp?action=add';document.myform.target='_self';"> 
<input name="Key" type="hidden" id="Key2" value="key"><%session("action")=("add")%>
</p>
</div>
</form>
</td>
</tr>
</table>


下面文件传不到数据库里去,不知道哪里有问题..
保存上传: ProductSave.asp

<%@language=vbscript codepage=936 %>
<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<!--#include file="Inc/Function.asp"-->
<!--#include FILE="inc/upload_5xsoft.inc"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%
call checkmanage("03")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
dim rs,sql,ErrMsg,FoundErr
dim ProductID,Product_Id,BigClassName,SmallClassName,Title,Content,UpdateTime,Hits
dim IncludePic,DefaultPicUrl,UploadFiles,Elite,Passed,arrUploadFiles
dim ObjInstalled
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=false
ProductID=Trim(Request.Form("ProductID"))
Product_Id=trim(request.form("Product_Id"))
BigClassName=trim(request.form("BigClassName"))
SmallClassName=trim(request.form("SmallClassName"))
Title=trim(request.form("Title"))
Content=trim(request.form("Content"))
UpdateTime=trim(request.form("UpdateTime"))
IncludePic=trim(request.form("IncludePic"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
UploadFiles=trim(request.form("UploadFiles"))
Passed=trim(request.form("Passed"))
Elite=trim(request.form("Elite"))
Hits=trim(request.form("Hits"))
if BigClassName="" then
    founderr=true
    errmsg=errmsg+"<li>未指定文章所属大类</li>"
end if
if Title="" then
    founderr=true
    errmsg="<li>文章标题不能为空</li>"
end if
if Spec="" then
    Spec=null
end if
if Unit="" then
    Unit=null
end if
if Memo="" then
    Memo=null
end if

if Content="" then
    founderr=true
    errmsg=errmsg+"<li>文章内容不能为空</li>"
end if

if founderr=false then
    Title=dvhtmlencode(Title)    
    'Content=ubbcode(Content)
    if UpdateTime<>"" and IsDate(UpdateTime)=true then
        UpdateTime=CDate(UpdateTime)
    else
        UpdateTime=now()
    end if
    if Hits<>"" then
        Hits=CLng(Hits)
    else
        Hits=0
    end if
    set rs=server.createobject("adodb.recordset")
    if request("action")="add" then
        sql="select top 1 * from Product" 
        rs.open sql,conn,1,3
        rs.addnew
        call SaveData()        
        rs.update
        ArticleID=rs("ArticleID")
        rs.close
        set rs=nothing
    elseif request("action")="Modify" then
          if ArticleID<>"" then
            sql="select * from Product where articleid=" & ArticleID
            rs.open sql,conn,1,3
            if not (rs.bof and rs.eof) then
                call SaveData()
                rs.update
                rs.close
                set rs=nothing
             else
                founderr=true
                errmsg=errmsg+"<li>找不到此产品,可能已经被删除。</li>"
                call WriteErrMsg()
            end if
        else
            founderr=true
            errmsg=errmsg+"<li>不能确定ArticleID的值</li>"
            call WriteErrMsg()
        end if
    else
        founderr=true
        errmsg=errmsg+"<li>没有选定参数</li>"
        call WriteErrMsg()
    end if

    call CloseConn()
%>
</BODY>
</html>

回复列表 (共1个回复)

沙发

乖乖 这么多,怪不得没人回!顶下,本人眼花了!

我来回复

您尚未登录,请登录后再回复。点此登录或注册