You should try moving the rs code below the DFP upload code. So would want this code:
<%
var Recordset1__MMColParam = "77";
if (String(Request("MM_EmptyValue")) != "undefined" &&
String(Request("MM_EmptyValue")) != "") {
Recordset1__MMColParam = String(Request("MM_EmptyValue"));
}
%>
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_GIFTS_DB_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Product1 WHERE ID = ?";
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam)); // adDouble
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
To be just after this code:
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1") ;
if(String(WA_DFP_UploadObj.Form("UploadImage")) != "undefined"){
WA_DFP_UploadFile("WA_UploadResult1", "file", "Images/161_1_1_medium.jpg", "pics/", "[FileName]", "2", "[FileName]_[Increment]", "20074", "false", "0", "0");
Please give this a try and let us know what the result is when you test the page. If you have any more problems with this please post back with the page in a zip archive so that we can look into this further.