Ok, perhaps I didn't make myself clear. This page you see in the example, writes to the database and then writes the file to the file system. Below is the actual form:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
//TRAP the session ID and make sure nobody can copy and paste as FAVORITE
//Go to bottom of page and take back to Login Screen.
var SESSID = Request.QueryString("SESSI
//Response.Write("SESSIONI
//Response.Write(Session.S
if (SESSID = Session("SID"))
{
%>
<!--#include file="Connections/WebProje
<%
var documents__MM_ID = "1";
if (String(Request.QueryStrin
String(Request.QueryString
documents__MM_ID = String(Request.QueryString
}
%>
<%
var documents_cmd = Server.CreateObject ("ADODB.Command");
documents_cmd.ActiveConnec
documents_cmd.CommandText = "SELECT * FROM documents WHERE id = ?";
documents_cmd.Prepared = true;
documents_cmd.Parameters.A
var documents = documents_cmd.Execute();
var documents_numRows = 0;
%>
<%
var MaxDocVal__MM_PID = "AEPortal2007";
if (String(Request.QueryStrin
String(Request.QueryString
MaxDocVal__MM_PID = String(Request.QueryString
}
%>
<%
var MaxDocVal_cmd = Server.CreateObject ("ADODB.Command");
MaxDocVal_cmd.ActiveConnec
MaxDocVal_cmd.CommandText = "SELECT MAX(id) as Expr1000 FROM documents WHERE PID = ?";
MaxDocVal_cmd.Prepared = true;
MaxDocVal_cmd.Parameters.A
var MaxDocVal = MaxDocVal_cmd.Execute();
var MaxDocVal_numRows = 0;
%><%
var docCategory_cmd = Server.CreateObject ("ADODB.Command");
docCategory_cmd.ActiveConn
docCategory_cmd.CommandTex
docCategory_cmd.Prepared = true;
var docCategory = docCategory_cmd.Execute();
var docCategory_numRows = 0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add a Document</title>
<link href="css/general.css" rel="stylesheet" type="text/css" />
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/CalendarPopup
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/AnchorPositio
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/PopupWindow.j
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/date.js"></SCRI
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="scripts/general.js"></S
<script language="javascript" type="text/javascript">
var TYPE = "";
function setType(what)
{
//alert("WHAT::" + what);
TYPE = what;
}
function setMax()
{
var MAXVAL = document.getElementById("M
var Adder = 1;
var fn = (MAXVAL*1) + Adder;
document.getElementById("i
}
function getFileNameOnly(what)
{
//get path value (including file name)
var fileAndPath = document.getElementById(wh
//find the index of the last "\"
var lastPathDelimiter = fileAndPath.lastIndexOf("\
//get everything after the last "\"
var fileNameOnly = fileAndPath.substring(last
//var PathOnly = "E:\0\1\28\121\1517121\use
var PathOnly = "E:\\0\\1\\131\\30\\162068
//alert(PathOnly);
//alert(fileNameOnly);
document.getElementById('d
document.getElementById('D
//alert("TYPE::"+TYPE);
/***if (TYPE=="pdf")
{
window.open("uploadPdf.asp
}
if (TYPE=="doc")
{
window.open("uploadDocs.as
}
if (TYPE=="xls")
{
window.open("uploadXls.asp
}
if (TYPE=="ppt")
{
window.open("uploadPpt.asp
}
*/
}
function dateSet()
{
today = new Date();
document.getElementById('d
}
</script>
</head>
<body onload="setMax(); dateSet();">
<form name="theForm" action="ToDatabase.asp" enctype="MULTIPART/FORM-DA
<table align="center" class="silverinset">
<tr valign="baseline">
<td colspan="2" align="center" valign="top" nowrap="nowrap" class="titlecentercell">Doc
</tr>
<tr valign="baseline">
<td width="99" align="right" nowrap="nowrap" class="seltabcell">ID:</td>
<td width="490"><input type="text" name="id" id="id" value="" size="32" readonly="readonly" style="background-color:#C
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">Project Identification (PID):</td>
<td><input type="text" name="PID" value="<%=Request.QueryStri
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">File name:</td>
<td><input type="text" id="doc_name" name="doc_name" value="" size="32" readonly="readonly" style="background-color:#C
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">Category
<td><select name="doc_category" id="doc_category">
<option value="select">Select One</option>
<%
while (!docCategory.EOF) {
%><option value="<%=(docCategory.Fiel
<%
docCategory.MoveNext();
}
if (docCategory.CursorType > 0) {
if (!docCategory.BOF) docCategory.MoveFirst();
} else {
docCategory.Requery();
}
%>
</select></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">Comments
<td><textarea name="description" id="description" cols="45" rows="5"></textarea></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">File Path:</td>
<td><input type="file" id="myFile" name="myFile" value="" size="32" onchange="getFileNameOnly(
<input type="hidden" name="DocLoc" id="DocLoc" /></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">Display:
<td><input name="display" id="display" type="checkbox" value="1" checked="checked" readonly="readonly" style="background-color:#C
</tr>
<tr valign="baseline">
<td align="right" nowrap="nowrap" class="seltabcell">Date added:</td>
<td><input type="text" name="date_added" value="" size="32" readonly="readonly" style="background-color:#C
<a href="#" onclick="cal.select(docume
name="anchor1" id="anchor1"><img src="images/cal.gif" alt="Calendar" width="16" height="16" border="0" /></a></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><input name="goback" type="button" class="small" id="goback" onclick="changePageAdmin('
<td><input name="Submit" type="submit" class="small" value="Insert record" /> </td>
</tr>
</table>
<input type="hidden" id="MM_maxvalue" name="MM_maxvalue" value="<%=(MaxDocVal.Fields
</form>
<p> </p>
</body>
</html>
<%
documents.Close();
%>
<%
MaxDocVal.Close();
%>
<%
docCategory.Close();
%>
<%
//Trap attempt to copy and past URL into another browser
} else {
Response.Redirect("index.a
}
%>
As you can see, the ENC-TYPE is already what you suggested. So I'm back to square one. The form action goes to the ToDatabase.asp page, the first code snippet here. So, it's something with the previous code snippet or the server on Network Solutions that's not allowing the content of the file to be uploaded. Your thoughts...???
Thanks, peter
Main Topics
Browse All Topics





by: dankhasisPosted on 2008-12-02 at 00:00:12ID: 23075116
Because the form you are submitting is not enctype="multipart/form-da ta"