asp form表单为enctype="multipart/form-data"的老问题
我有两个页面 一个是form页面和一个提交页面
由于页面上有上传,所以用到了无组件上传,但是在取值的时候upload.form("txtTitle")取值,所有的文本框都可以取值,唯独是多行文本框不能取值,不知道该如何去写,请各位大大帮帮忙
前端页面
form页面
路径是打印出来了,但是内容却没有打印出来 请大大们帮帮忙
由于页面上有上传,所以用到了无组件上传,但是在取值的时候upload.form("txtTitle")取值,所有的文本框都可以取值,唯独是多行文本框不能取值,不知道该如何去写,请各位大大帮帮忙
前端页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
dim strId,strUser
if len(session("UID"))<=0 then
response.Redirect("BackLogin.asp")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新增党的关怀</title>
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="JS/jquery-1.4.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#btnSub").click(function(){
$("#spTitle").text("");
$("#spImg").text("");
$("#spContext").text("");
var strTitle=$.trim($("#txtTitle").val());
var strImg=$.trim($("#flImg").val());
var strContext=$.trim($("#txtContext").val());
var strUrl=$.trim($("#txtURL").val());
if(strTitle.length<=0){
$("#spTitle").text("页面标题不能为空");
$("#txtTitle").val("");
$("#txtTitle").focus();
} else if(strImg.length<=0){
$("#spImg").text("上传图片不能为空");
$("#flImg").val("");
$("#flImg").focus();
}else if(!/.(gif|jpg|jpeg|png|gif|jpg|png)$/.test(strImg)){
$("#spImg").text("图片类型必须是.gif,jpeg,jpg,png中的一种");
$("#flImg").val("");
$("#flImg").focus();
} else if(strContext.length<=0){
$("#spContext").text("内容不能为空");
$("#txtContext").val("");
$("#txtContext").focus();
} else if(strUrl.length<=0){
$("#spURL").text("内容页面路径不能为空");
} else {
$("form").submit();
}
});
});
function pressFun(){
var picImg=$("#flImg").val();
if(picImg==null || ""==picImg){
$("#spImg").text("请点击左边浏览按钮!");
}else{
$("#spImg").text("");
}
}
</script>
</head>
<body class="ContentBody">
<div class="MainDiv">
<form action="BackAddIndexServer.asp" method="post" enctype="multipart/form-data">
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
<tr>
<th class="tablestyle_title" >党的关怀基本信息录入</th>
</tr>
<tr>
<td class="CPanel">
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<TR>
<TD width="100%">
<fieldset style="height:100%;">
<legend>党的关怀</legend>
<table id="tb" border="0" cellpadding="2" cellspacing="1" style="width:100%">
<tr>
<td nowrap align="right" width="43%">页面标题:</td>
<td width="57%">
<input class="text" id="txtTitle" name='txtTitle' style="width:154px" value=""/>
<span class="red" id="spTitle"></span></td>
</tr>
<tr>
<td nowrap align="right" width="43%" >上传图片:</td>
<td width="57%">
<input type="file" id="flImg" name="flImg" class="text" onkeydown="pressFun();return false;" style="width:223px;"/>
<span class="red" id="spImg"></span></td>
</tr>
<tr>
<td nowrap align="right" width="43%">内容页面路径:</td>
<td width="57%">
<input class="text" id="txtURL" name='txtURL' style="width:154px" value="" />
<span class="red" id="spURL"></span></td>
</tr>
<tr>
<td nowrap align="right" width="43%">内容:</td>
<td width="57%">
<textarea id="txtContext" name="txtContext" cols="35" rows="6"></textarea>
<span class="red" id="spContext"></span></td>
</tr>
</table>
<br />
</fieldset> </TD>
</TR>
</TABLE>
</td>
</tr>
<TR>
<TD colspan="2" align="center" height="50px">
<input type="button" id="btnSub" name="btnSub" value="保存" class="button"/>
<input type="reset" name="btnReset" id="btnReset" value="重置" class="button" /></TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
form页面
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Code/conn.asp"-->
<!--#include file="Code/upload_asjob.asp"-->
<%
set upload=new upload_5xsoft
dim strReturn,strTitle,strContext,strUrl
strReturn="T"
strTitle=upload.form("txtTitle")
strContext=upload.form("txtContext")
strUrl=upload.form("txtURL")
response.Write(strUrl&"<br>")
response.Write(strContext)
%>
路径是打印出来了,但是内容却没有打印出来 请大大们帮帮忙
...全文
相关推荐
js动态在form上插入enctype=multipart/form-data的问题
我们都知道要让form能提交文件,需要在form上指定enctype=multipart/form-data的attribute,这样才能上传文件,关于enctype的文章很多,就不再做解释。 问题是因为使用了MVC的Html.BeginForm()来输出表单代码,默认是没有加入enctype的, 代码如下: @using (Html.BeginForm()) { } 在PartialView中有一个<input type=”file” />用来上传文件,又不想为了这个PartialView去修改父页面的Html.BeginForm(),我的做法是在PartialView中用脚本来为for
Asp.net MVC 处理文件的上传下载
Asp.net MVC 处理文件的上传下载Asp.net MVC 处理文件的上传下载
asp.net 模拟提交有文件上传的表单(通过http模拟上传文件)
通过HTTP模拟GET或POST请求,提交数据到服务端获取响应,比较常见些;但如上传文件到服务端,使用html form当然简单了,而因环境所限有时需要使用模拟方法去提交有附件(文件上传)的表单。
asp上传文件代码详解
文件上传的实现 asp上传文件代码详解 文件上传的实现 asp上传文件代码详解
【ASP.NET编程知识】Asp.net实现MVC处理文件的上传下载功能实例教程.docx
【ASP.NET编程知识】Asp.net实现MVC处理文件的上传下载功能实例教程.docx



