Forums

This topic is locked

Pue ASP Upload causing Memo filed insert problem?

Posted 17 Jul 2007 16:37:01
1
has voted
17 Jul 2007 16:37:01 Matthew Horner posted:
Hi all,

I've taken over a site (ASP, VB, Access 2000) which utilizes Pure ASP Upload 3.0.5 as part of the admin pages. The functionality of the upload works ok but part of the other elements of this particular admin page don't and I wonder if this is due to the integration of PAU as we don't normally have these problems.

Basically, there are 2 memo fields (para1 and para2) which are used to store the bulk of the page content and hold html code. If either of the memo fields have 'too much' information added to them the insert statement does not error BUT only a certain amount of the data which should be inserted is inserted (it's data from the end of the input that is retained rather than the beginning).

I've added the insert code below - does anything stand out as being likely to cause this type of error?

<pre id=code><font face=courier size=2 id=code> &lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&gt;
&lt;!--#include file="../../Connections/xxx.asp" --&gt;
&lt;!--#include file="../authentication.asp" --&gt;
&lt;!--#include file="../../ScriptLibrary/incPU3Class.asp" --&gt;
&lt;!--#include file="../../ScriptLibrary/incPU3Utils.asp" --&gt;
&lt;%
'*** Pure ASP File Upload 3.0.5
' Process form form1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "../../ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.UploadFolder = """../../uploads"""
pau.ProcessUpload
pau.SaveAll
%&gt;
&lt;%
' *** Edit Operations: (Modified for File Upload) declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (UploadQueryString &lt;&gt; "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%&gt;
&lt;%
' *** Update Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_update") = "form1" And CStr(UploadFormRequest("MM_recordId") &lt;&gt; "" Then

MM_editConnection = MM_covers_STRING
MM_editTable = "tbl_services"
MM_editColumn = "ID"
MM_recordId = "" + UploadFormRequest("MM_recordId" + ""
MM_editRedirectUrl = "thanks.asp"
MM_fieldsStr = "dateedited|value|category|value|name|value|title|value|subtitle|value|para1|value|para2|value|para3|value|promo|value|cts|value|file|value|alt1|value|file2|value|alt2|value|file3|value|alt3|value|file4|value|file5|value|file6|value|related1|value|related2|value|related3|value|related4|value|related5|value|related6|value|related7_name|value|related7_link|value|related8_name|value|related8_link|value|related9_name|value|related9_link|value|static1|value|static2|value|static3|value"
MM_columnsStr = "dateedited|',none,NULL|category|',none,''|name|',none,''|title|',none,''|subtitle|',none,''|para1|',none,''|para2|',none,''|para3|',none,''|promo|',none,''|cts|',none,''|image1|',none,''|alt1|',none,''|image2|',none,''|alt2|',none,''|image3|',none,''|alt3|',none,''|logo1|',none,''|logo2|',none,''|logo3|',none,''|related1|',none,''|related2|',none,''|related3|',none,''|related4|',none,''|related5|',none,''|related6|',none,''|related7_name|',none,''|related7_link|',none,''|related8_name|',none,''|related8_link|',none,''|related9_name|',none,''|related9_link|',none,''|static1|',none,''|static2|',none,''|static3|',none,''"

' create the MM_fields and MM_columns arrays
MM_columnsStr = FixColumnsForUpload(MM_fieldsStr,MM_columnsStr)
MM_fieldsStr = FixFieldsForUpload(MM_fieldsStr,MM_columnsStr)
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(UploadFormRequest(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl &lt;&gt; "" And UploadQueryString &lt;&gt; "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString &lt;&gt; "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%&gt;
&lt;%
' *** Update Record: (Modified for File Upload) construct a sql update statement and execute it

If (CStr(UploadFormRequest("MM_update") &lt;&gt; "" And CStr(UploadFormRequest("MM_recordId") &lt;&gt; "" Then

' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal &lt;&gt; "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i &lt;&gt; LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl &lt;&gt; "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%&gt;</font id=code></pre id=code>

Thanks in advance
Matt

www.kmdwebdesign.com

Reply to this topic