Pure ASP Upload 3 Support Product Page

Microsoft JScript runtime error '800a138f'

Asked 14 Feb 2011 18:40:15
2
have this question
14 Feb 2011 18:40:15 Andrew Pratt posted:
Hi,

Been struggling with this for a few days, getting error:


Microsoft JScript runtime error '800a138f' 

Object expected 

/select/upload3.asp, line 39 




upload3.asp:


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/db2.asp" -->
<!--#include file="ScriptLibrary/incPU3Class.asp" -->
<!--#include file="ScriptLibrary/incPU3Utils.asp" -->
<
%//*** Pure ASP File Upload 3.0.17
// Process form PicUpload
var pau = CreatePureUpload(), DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight;
pau.ScriptLibrary = "ScriptLibrary";
pau.ConflictHandling = "over";
pau.StoreType = "file";
pau.UploadFolder = "./files/";
pau.ProcessUpload();
pau.SaveAll();
%>
<
%// *** Edit Operations: (Modified for File Upload) declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (UploadQueryString) {
  MM_editAction += "?" + Server.HTMLEncode(UploadQueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;
%>
<
%if (String(UploadFormRequest("MM_update")) == "PicUpload") {
  if (!MM_abortEdit) {
    // execute the update
	
    var MM_editCmd = Server.CreateObject ("ADODB.Command");
    MM_editCmd.ActiveConnection = MM_db2_STRING;
    MM_editCmd.CommandText = "UPDATE carspictures SET pic1 = ? WHERE CarID = ?";
    MM_editCmd.Prepared = true;
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 202, 1, 250, MM_IIF(UploadFormRequest("Pic1"), UploadFormRequest("Pic1"), UploadFormRequest("upload_org_Pic1")))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 5, 1, -1, (String(UploadFormRequest("MM_recordId")) != "undefined" && String(UploadFormRequest("MM_recordId")) != "") ? UploadFormRequest("MM_recordId") : null)); // adDouble
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    // append the query string to the redirect URL
    var MM_editRedirectUrl = "index.asp";
    if (MM_editRedirectUrl && UploadQueryString && UploadQueryString.length > 0) {
      MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1) ? "?" : "&") + UploadQueryString;
    }
    Response.Redirect(MM_editRedirectUrl)
  }
}
%>
<
%var pics__MMColParam = "1";
if (String(Request.QueryString("CarID")) != "undefined" && 
    String(Request.QueryString("CarID")) != "") { 
  pics__MMColParam = String(Request.QueryString("CarID"));
}
%>
<
%var pics_cmd = Server.CreateObject ("ADODB.Command");
pics_cmd.ActiveConnection = MM_db2_STRING;
pics_cmd.CommandText = "SELECT * FROM carspictures WHERE CarID = ?";
pics_cmd.Prepared = true;
pics_cmd.Parameters.Append(pics_cmd.CreateParameter("param1", 5, 1, -1, pics__MMColParam)); // adDouble

var pics = pics_cmd.Execute();
var pics_numRows = 0;
%>
<!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=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>

<body>
<form action="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="PicUpload" onsubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
  <p>
    <label for="Pic1">Picture1</label>
    <input name="Pic1" type="file" id="Pic1" onchange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(pics.Fields.Item("pic1").Value)%>" />
  </p>
  <p>&nbsp;</p>
  <p>
    <label for="Submit">Submit</label>
    <input type="submit" name="Submit" id="Submit" value="Submit" />
  </p>
  <p>&nbsp;</p>
  <input type="hidden" name="MM_update" value="PicUpload" />
  <input type="hidden" name="MM_recordId" value="<%= pics.Fields.Item("CarID").Value %>" />
  <input type="hidden" name="upload_org_Pic1" value="<%=(pics.Fields.Item("pic1").Value)%>" />
</form>

</body>
</html>
<
%pics.Close();
%>


It seems to upload the file, but not update the record?

Thanks for any help.

Replies

Replied 15 Feb 2011 12:13:49
15 Feb 2011 12:13:49 Miroslav Zografski replied:
Hello Andrew,

Please, try following:

1) Create the form that will serve you to update the record.
2) Apply the Pure Uploader
3) Apply the rest of server behaviors like Recordset and Update record SB.

Regards,
Replied 15 Feb 2011 16:17:47
15 Feb 2011 16:17:47 Andrew Pratt replied:
Hi, Thanks for the reply.

I tried as you suggested, however get the same error:


Microsoft JScript runtime error '800a138f' 

Object expected 

/select/upload7.asp, line 40 


upload7.asp:


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/db2.asp" -->
<!--#include file="ScriptLibrary/incPU3Class.asp" -->
<!--#include file="ScriptLibrary/incPU3Utils.asp" -->
<
%//*** Pure ASP File Upload 3.0.17
// Process form upload
var pau = CreatePureUpload(), DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_sav[:(][:(]eWidth, pau_saveHeight;
pau.ScriptLibrary = "ScriptLibrary";
pau.ConflictHandling = "over";
pau.StoreType = "file";
pau.UploadFolder = "./files/";
pau.ProcessUpload();
pau.SaveAll();
if (pau.Done) {
  SetUploadFormRequest("upload_org_pic1",pau.Fields("pic1").FileName);
}
%>
<
%// *** Edit Operations: (Modified for File Upload) declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (UploadQueryString) {
  MM_editAction += "?" + Server.HTMLEncode(UploadQueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;
%>
<
%if (String(UploadFormRequest("MM_update")) == "upload") {
  if (!MM_abortEdit) {
    // execute the update
	
    var MM_editCmd = Server.CreateObject ("ADODB.Command");
    MM_editCmd.ActiveConnection = MM_db2_STRING;
    MM_editCmd.CommandText = "UPDATE carspictures SET pic1 = ? WHERE CarID = ?";
    MM_editCmd.Prepared = true;
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 202, 1, 250, MM_IIF(UploadFormRequest("pic1"), UploadFormRequest("pic1"), UploadFormRequest("upload_org_pic1")))); // adVarWChar
    MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 5, 1, -1, (String(UploadFormRequest("MM_recordId")) != "undefined" && String(UploadFormRequest("MM_recordId")) != "") ? UploadFormRequest("MM_recordId") : null)); // adDouble
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();
  }
}
%>
<
%var pictures__MMColParam = "1";
if (String(Request.QueryString("CarID")) != "undefined" && 
    String(Request.QueryString("CarID")) != "") { 
  pictures__MMColParam = String(Request.QueryString("CarID"));
}
%>
<
%var pictures_cmd = Server.CreateObject ("ADODB.Command");
pictures_cmd.ActiveConnection = MM_db2_STRING;
pictures_cmd.CommandText = "SELECT * FROM carspictures WHERE CarID = ?";
pictures_cmd.Prepared = true;
pictures_cmd.Parameters.Append(pictures_cmd.CreateParameter("param1", 5, 1, -1, pictures__MMColParam)); // adDouble

var pictures = pictures_cmd.Execute();
var pictures_numRows = 0;
%>
<!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=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>

<body>
<form action="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="upload" onsubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
  <p>
    <label>Pic 1
      <input name="pic1" type="file" id="pic1" onchange="<%=pau.validateCode()%>;return document.MM_returnValue" value="<%=(pictures.Fields.Item("pic1").Value)%>" />
    </label>
  </p>
  <p>&nbsp;</p>
  <p>
    <label>
      <input type="submit" name="submit" id="submit" value="Submit" />
    </label>
  </p>
  <input type="hidden" name="MM_update" value="upload" />
  <input type="hidden" name="MM_recordId" value="<%= pictures.Fields.Item("CarID").Value %>" />
  <input type="hidden" name="upload_org_pic1" value="<%=(pictures.Fields.Item("pic1").Value)%>" />
</form>
</body>
</html>
<
%pictures.Close();
%>



Your help would be appreciated?! This is getting me down!!
Replied 22 Feb 2011 18:47:15
22 Feb 2011 18:47:15 Andrew Pratt replied:
No one got any ideas?!!
Replied 23 Feb 2011 11:39:42
23 Feb 2011 11:39:42 Miroslav Zografski replied:
Hello Andrew,

What do you need this filed for:
<input type="hidden" name="upload_org_pic1" value="<%=(pictures.Fields.Item("pic1".Value)%>" />
Can you try without it ?

Regards,

Reply to this topic