I have a cms system for a web site that uses asp and a database. Thereis an add record page and an update record page that both have a list box that allows multiple selections. I used the funtions for inserting and updating records in a database that are built in to Dreamweaver MX 2004 (I think they are the same in MX). This work fine. However, I needed to give the user the ability to upload a picture and then have the path and name of the picture placed in a field on the database as well. I found an asp upload extension on Macromedia's site that was developed by a guy named Revello Gianluigi. This extension was recommended by Macromedia and said that it used the built in funtions for inserting and updating records but just added the ability to upload files. I used this extension and it worked great but for one thing. Now when I have multiple items selected in the list box it only uploads the first item. This is very bad because the user has to be able to select multiple values. I am not an asp programmer and thus do not really understand the code that the extension created. I need to find a way to modify it though to allow for the multiple selections to be passed as comma seperated values into the database. I have the same problem whether I am using the add or update page. Here is the script that the extension created. The server language is asp vb.
'*****************************************
'* *
'* INSERT RECORD AND UPLOAD *
'* if remove this comment Dreamveaver *
'* don't recognize the behaviors *
'* *
'*****************************************
server.ScriptTimeout = 5400
Dim RG_altVal, RG_columns, RG_Cong, RG_dbValues, RG_dbValuesTmp, RG_delim, RG_editCmd, RG_editQuery, RG_editQueryTmp, RG_emptyVal, RG_Ext, RG_Extensions, RG_fields, RG_FieldValueTmp, RG_FileDel, RG_FileExt, RG_formVal, RG_FS, RG_i, RG_L, RG_Len, RG_Max, RG_Name, RG_New, RG_newName, RG_Num, RG_Path, RG_Rec, RG_ret, RG_Save, RG_tableValues, RG_tableValuesTmp, RG_tst, RG_typeArray, RG_z, UploadStatus, NumFile
Dim RG_Connection, RG_editColumn, RG_recordId, Form, editAction, editRedirectUrl, RG_Files, RG_formName, UploadType, ParamVal, ParamList, MaxFieldNumber, TmpVal, x, y, Key, ProgressBar
Dim tmpField_Name(), tmpValue_Name(), tmpField_Size(), tmpValue_Size(), QtyRecord
Set Form = New ASPForm
Dim UploadID
UploadID = Form.NewUploadID
ProgressBar = "progress-std.asp"
editRedirectUrl = "/admin.asp"
RG_Connection = MM_conn_mckibben_STRING
RG_editTable = "tblPropertyInfo"
RG_Files = "/images/listings/;1;;;;1;PictureURL;1;;;;0;;;flPictureURL|/images/listings/;1;;;;1;SitePlanURL;1;;;;0;;;flSitePlanURL@_@_@1"
RG_formName = "frmAddListing"
UploadType="Insert"
UploadStatus = ""
NumFile = 0
if len(Request.QueryString("UploadID"
)>0 then
Form.UploadID = Request.QueryString("UploadID"
end if
if (Request.QueryString <> ""
Then
editAction = CStr(Request.ServerVariables("SCRIPT_NAME"
) & "?" & Request.QueryString & "&UploadID=" & UploadID
else
editAction = CStr(Request.ServerVariables("SCRIPT_NAME"
) & "?UploadID=" & UploadID
End If
Const fsCompletted = 0
If Form.State = fsCompletted Then
if Form.State = 0 then
Set ParamVal = CreateObject("Scripting.Dictionary"
tmp = split(RG_Files,"@_@_@"
ParamList = split(tmp(0),"|"
MaxFieldNumber = ubound(ParamList)
for x=0 to Ubound(ParamList)
TmpVal = Split(ParamList(x),";"
for y=0 to ubound(TmpVal)
Key = cstr(x) & cstr
ParamVal.add Key, TmpVal
next
next
Form.Files.Save
RG_fieldsStr = "txtAddress|value|txtCity|value|txtSqFt|value|txtPrice|value|txtType|value|txtAgent|value|lstCategory|value|txtForLeaseSale|value|txtBuildingName|value|txtHeading|value|txtPictureCaption|value|txtPricingDesc|value|txtBullet1|value|txtBullet2|value|txtRemarks|value"
RG_columnsStr = "Address|',none,''|City|',none,''|SqFt|',none,''|Price|',none,''|Type|',none,''|Agent|',none,''|Category|',none,''|LeaseSale|',none,''|BuildingName|',none,''|Heading|',none,''|PictureCaption|',none,''|PricingDesc|',none,''|BulletList1|',none,''|BulletList2|',none,''|Remarks|',none,''"
Form.Files.DataBaseInsert
response.write(getRedirect())
response.end
End If
ElseIf Form.State > 10 then
response.write "<br><Font Color=red>Some form error.</Font><br>"
End If
function GetFolderName(str): GetFolderName = Ris : end function
function myGetFileName(str): myGetFileName = Ris : end function
%>
'*****************************************
'* *
'* INSERT RECORD AND UPLOAD *
'* if remove this comment Dreamveaver *
'* don't recognize the behaviors *
'* *
'*****************************************
server.ScriptTimeout = 5400
Dim RG_altVal, RG_columns, RG_Cong, RG_dbValues, RG_dbValuesTmp, RG_delim, RG_editCmd, RG_editQuery, RG_editQueryTmp, RG_emptyVal, RG_Ext, RG_Extensions, RG_fields, RG_FieldValueTmp, RG_FileDel, RG_FileExt, RG_formVal, RG_FS, RG_i, RG_L, RG_Len, RG_Max, RG_Name, RG_New, RG_newName, RG_Num, RG_Path, RG_Rec, RG_ret, RG_Save, RG_tableValues, RG_tableValuesTmp, RG_tst, RG_typeArray, RG_z, UploadStatus, NumFile
Dim RG_Connection, RG_editColumn, RG_recordId, Form, editAction, editRedirectUrl, RG_Files, RG_formName, UploadType, ParamVal, ParamList, MaxFieldNumber, TmpVal, x, y, Key, ProgressBar
Dim tmpField_Name(), tmpValue_Name(), tmpField_Size(), tmpValue_Size(), QtyRecord
Set Form = New ASPForm
Dim UploadID
UploadID = Form.NewUploadID
ProgressBar = "progress-std.asp"
editRedirectUrl = "/admin.asp"
RG_Connection = MM_conn_mckibben_STRING
RG_editTable = "tblPropertyInfo"
RG_Files = "/images/listings/;1;;;;1;PictureURL;1;;;;0;;;flPictureURL|/images/listings/;1;;;;1;SitePlanURL;1;;;;0;;;flSitePlanURL@_@_@1"
RG_formName = "frmAddListing"
UploadType="Insert"
UploadStatus = ""
NumFile = 0
if len(Request.QueryString("UploadID"
Form.UploadID = Request.QueryString("UploadID"
end if
if (Request.QueryString <> ""
editAction = CStr(Request.ServerVariables("SCRIPT_NAME"
else
editAction = CStr(Request.ServerVariables("SCRIPT_NAME"
End If
Const fsCompletted = 0
If Form.State = fsCompletted Then
if Form.State = 0 then
Set ParamVal = CreateObject("Scripting.Dictionary"
tmp = split(RG_Files,"@_@_@"
ParamList = split(tmp(0),"|"
MaxFieldNumber = ubound(ParamList)
for x=0 to Ubound(ParamList)
TmpVal = Split(ParamList(x),";"
for y=0 to ubound(TmpVal)
Key = cstr(x) & cstr
ParamVal.add Key, TmpVal
next
next
Form.Files.Save
RG_fieldsStr = "txtAddress|value|txtCity|value|txtSqFt|value|txtPrice|value|txtType|value|txtAgent|value|lstCategory|value|txtForLeaseSale|value|txtBuildingName|value|txtHeading|value|txtPictureCaption|value|txtPricingDesc|value|txtBullet1|value|txtBullet2|value|txtRemarks|value"
RG_columnsStr = "Address|',none,''|City|',none,''|SqFt|',none,''|Price|',none,''|Type|',none,''|Agent|',none,''|Category|',none,''|LeaseSale|',none,''|BuildingName|',none,''|Heading|',none,''|PictureCaption|',none,''|PricingDesc|',none,''|BulletList1|',none,''|BulletList2|',none,''|Remarks|',none,''"
Form.Files.DataBaseInsert
response.write(getRedirect())
response.end
End If
ElseIf Form.State > 10 then
response.write "<br><Font Color=red>Some form error.</Font><br>"
End If
function GetFolderName(str): GetFolderName = Ris : end function
function myGetFileName(str): myGetFileName = Ris : end function
%>