Forums
This topic is locked
pure asp upload 3
06 Oct 2006 17:22:47 Marc M posted:
I made a small form to write in a database. With success.When I replace one text field in a file field and add 'pure upload asp 3' it's going wrong.
The file in the file field is uploaded correctly, but nothing of the other text fields is written in the database.
With 'pure asp upload 2' I didn't have this problem.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/con_portfolio.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME"
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}
// boolean to abort record edit
var MM_abortEdit = false;
%>
<%
if (String(Request("MM_insert") == "form1" {
if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject ("ADODB.Command"
MM_editCmd.ActiveConnection = MM_con_portfolio_STRING;
MM_editCmd.CommandText = "INSERT INTO resultaten (ood, academiejaar, jaar, oefening, fotos) VALUES (?, ?, ?, ?, ?)";
MM_editCmd.Prepared = true;
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("ood")); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("academiejaar")); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("jaar")); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4", 202, 1, 255, Request.Form("oefening")); // adVarWChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5", 202, 1, 255, Request.Form("fotos")); // adVarWChar
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
// append the query string to the redirect URL
var MM_editRedirectUrl = "master.asp";
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1) ? "?" : "&" + Request.QueryString;
}
Response.Redirect(MM_editRedirectUrl)
}
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="form1">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Ood:</td>
<td><input type="text" name="ood" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Academiejaar:</td>
<td><input type="text" name="academiejaar" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Jaar:</td>
<td><input type="text" name="jaar" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Oefening:</td>
<td><input type="text" name="oefening" value="" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fotos:</td>
<td><label>
<input name="fotos" type="file" id="fotos" />
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insert record">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</body>
</html>
Replies
Replied 12 May 2008 19:58:43
12 May 2008 19:58:43 Chris Potter replied:
I am having the EXACT same problem! Never had this happen before! Anyone have any ideas?