leeboycymru
Programmer
Basically what I've got is a problem when I'm trying to upload an image in an 'edit' page via the cms.
I have 6 images that are uploaded fine via a 'add product' page, then when I go to my edit page and for example change 1 of those images of the 6 and upload that, I get problems, but all is fine if when im in the 'edit' page I change another piece of data and submit.
I have included below the 2 pages that are used when 'editing' a selection.
IF NOT rsuserU.EOF THEN
artTitle = rsuserU( "art_Title" )
artCategory = rsuserU( "art_Category" )
artBriefDesc = rsuserU( "art_BDescription" )
artPrice = rsuserU( "art_Price" )
artPicFull = rsuserU( "art_ThumbFull" )
artFace = rsuserU( "art_ThumbFace" )
artHood = rsuserU( "art_ThumbHood" )
artExtra1 = rsuserU( "image_Extra1" )
artExtra2 = rsuserU( "image_Extra2" )
artExtra3 = rsuserU( "image_Extra3" )
artCaseDesc = rsuserU( "case_Text" )
artDialDesc = rsuserU( "dial_Text" )
artMovementDesc = rsuserU( "movement_Text" )
artMakerDesc = rsuserU( "maker_Text" )
artDatDesc = rsuserU( "dat_Text" )
artHeightDesc = rsuserU( "height_Text" )
artStatus = rsuserU( "art_Status" )
artMoonDisplay = rsuserU( "art_MoonDisplay" )
artDisplay = rsuserU( "art_Display" )
END IF
rsuserU.Close
FUNCTION SELECTED( firstVal, secondVal )
IF cSTR( firstVal ) = cSTR( secondVal ) THEN
SELECTED = " SELECTED "
END IF
END FUNCTION
%>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
.style2 {color: #FFFFFF}
-->
</style>
<body bgcolor="White">
<span class="style2">
<form method="post" enctype="multipart/form-data" action="manageproducts_art.asp">
<center>
<table width="700" border="1" bgcolor="White" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" bgcolor="yellow"><b>
Edit or Update Clock Information: </b>
</td>
</tr>
<tr>
<td><b>Title:</b>
</td>
<td><input name="artTitle" size="50" maxlength="50" value="<%=Server.HTMLEncode( artTitle )%>">
</td>
</tr>
<tr>
<td><b>Category:</b>
</td>
<td> <select name="artCategory">
<option value="Longcase Mahogany" <%=SELECTED( "Longcase Mahogany", artCategory )%>>Longcase Mahogany
<option value="Longcase Oak" <%=SELECTED( "Longcase Oak", artCategory )%>>Longcase Oak
<option value="Longcase Walnut" <%=SELECTED( "Longcase Walnut", artCategory )%>>Longcase Walnut
<option value="Longcase Marquetry" <%=SELECTED( "Longcase Marquetry", artCategory )%>>Longcase Marquetry
<option value="Longcase Lacquer" <%=SELECTED( "Longcase Lacquer", artCategory )%>>Longcase Lacquer
<option value="Longcase Miscellaneous" <%=SELECTED( "Longcase Miscellaneous", artCategory )%>>Longcase Miscellaneous
<option value="Other clocks and instruments" <%=SELECTED( "Other clocks and instruments", artCategory )%>>Other clocks and instruments
<option value="Barometers" <%=SELECTED( "Barometers", artCategory )%>>Barometers
<option value="Restoration" <%=SELECTED( "Restoration", artCategory )%>>Restoration
<option value="Longcase Mahogany Archive" <%=SELECTED( "Longcase Mahogany Archive", artCategory )%>>Longcase Mahogany Archive
<option value="Longcase Oak Archive" <%=SELECTED( "Longcase Oak Archive", artCategory )%>>Longcase Oak Archive
<option value="Longcase Walnut Archive" <%=SELECTED( "Longcase Walnut Archive", artCategory )%>>Longcase Walnut Archive
<option value="Longcase Marquetry Archive" <%=SELECTED( "Longcase Marquetry Archive", artCategory )%>>Longcase Marquetry Archive
<option value="Longcase Lacquer Archive" <%=SELECTED( "Longcase Lacquer Archive", artCategory )%>>Longcase Lacquer Archive
<option value="Longcase Miscellaneous Archive" <%=SELECTED( "Longcase Miscellaneous Archive", artCategory )%>>Longcase Miscellaneous Archive
<option value="Other clocks and instruments Archive" <%=SELECTED( "Other clocks and instruments Archive", artCategory )%>>Other clocks and instruments Archive
<option value="Barometers Archive" <%=SELECTED( "Barometers Archive", artCategory )%>>Barometers Archive
</select></td>
</tr>
<tr>
<tr>
<td><b>Brief Description:</b>
</td>
<td><textarea name="artBriefDesc" cols="50" rows="5"><%=Server.HTMLEncode( artBriefDesc )%></textarea>
</td>
</tr>
<tr>
<tr>
<td><b>Price:</b>
</td>
<td><input name="artPrice" size="50" maxlength="50" value="<%=Server.HTMLEncode( artPrice )%>">
</td>
</tr>
<tr>
<td bgcolor="#990000"><span class="style1">Please note!</span> </td>
<td bgcolor="#990000"><span class="style1">When changing an image, you have to change or re-load all 6 </span></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Full Length Clock Picture:</b></td>
<td><strong><%=Server.HTMLEncode( artPicFull )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Full Length Clock Picture:</b> </td>
<td><input name="artPicFull" size="50" type="file" /></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Clock Face Picture:</b> </td>
<td><strong><%=Server.HTMLEncode( artFace )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Clock Face Picture:</b> </td>
<td><input name="artFace" size="50" type="file" /></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Clock Hood Picture:</b> </td>
<td><strong><%=Server.HTMLEncode( artHood )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Clock Hood Picture:</b> </td>
<td><input name="artHood" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 1:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra1 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 1:</b> </td>
<td><input name="artExtra1" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 2:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra2 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 2:</b> </td>
<td><input name="artExtra2" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 3:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra3 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 3:</b> </td>
<td><input name="artExtra3" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#990000"><span class="style1">Please note!</span> </td>
<td bgcolor="#990000"><span class="style1">When changing an image, you have to change or re-load all 6</span></td>
</tr>
<tr>
<td><b>Case Description:</b>
</td>
<td><textarea name="artCaseDesc" cols="50" rows="5"><%=Server.HTMLEncode( artCaseDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Dial Description:</b>
</td>
<td><textarea name="artDialDesc" cols="50" rows="5"><%=Server.HTMLEncode( artDialDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Movement Description:</b>
</td>
<td><textarea name="artMovementDesc" cols="50" rows="5"><%=Server.HTMLEncode( artMovementDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Maker Description:</b>
</td>
<td><textarea name="artMakerDesc" cols="50" rows="5"><%=Server.HTMLEncode( artMakerDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Date Description:</b>
</td>
<td><textarea name="artDatDesc" cols="50" rows="5"><%=Server.HTMLEncode( artDatDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Height Description:</b>
</td>
<td><textarea name="artHeightDesc" cols="50" rows="5"><%=Server.HTMLEncode( artHeightDesc )%></textarea>
</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td><select name=artStatus id="select">
<option value="IN STOCK" <%=SELECTED( "IN STOCK", artStatus )%>>IN STOCK
<option value="SOLD" <%=SELECTED( "SOLD", artStatus )%>>SOLD
</select></td>
</tr>
<tr>
<td><strong>Moon Image Display:</strong></td>
<td><select name=artMoonDisplay id="select">
<option value="1" <%=SELECTED( "1", artMoonDisplay )%>>YES
<option value="0" <%=SELECTED( "0", artMoonDisplay )%>>NO
</select></td>
</tr>
<tr>
<td><strong>Display:</strong></td>
<td><select name=artDisplay id="select">
<option value="1" <%=SELECTED( "1", artDisplay )%>>YES
<option value="0" <%=SELECTED( "0", artDisplay )%>>NO
</select></td>
</tr>
<tr>
<tr>
<td><a href="../adminPage.asp">Back </a></td>
<td><div align="right">
<input type="hidden" name="origImage" value="<%=Server.HTMLEncode( artPicFull )%>" />
<input type="hidden" name="origFImage" value="<%=Server.HTMLEncode( artFace )%>" />
<input type="hidden" name="origHImage" value="<%=Server.HTMLEncode( artHood )%>" />
<input type="hidden" name="origExtra1" value="<%=Server.HTMLEncode( artExtra1 )%>" />
<input type="hidden" name="origExtra2" value="<%=Server.HTMLEncode( artExtra2 )%>" />
<input type="hidden" name="origExtra3" value="<%=Server.HTMLEncode( artExtra3 )%>" />
<input name="catID" type="hidden" value="<%=catID%>">
<input name="updateProduct" type="hidden" value="1">
<input name="submit" type="submit" value="submit">
</div></td>
</tr>
</table>
</center>
</form>
This is then submitted here:
if instr(Trim(Request.ServerVariables("HTTP_REFERER")),"addproduct_art.asp") or instr(Trim(Request.ServerVariables("HTTP_REFERER")),"updateproduct_art.asp") then
Set Upload = Server.CreateObject("Persits.Upload")
theCount = upload.save(server.mappath("..")&"\images\uploaded")
dim arr(6), i
i = 1
For Each File in Upload.Files
arr(i) = File.FileName
i = i + 1
Next
'Count = Upload.SaveVirtual("../upload")
' Get the form variables
addProduct = TRIM (Upload.Form("addProduct"))
updateProduct = TRIM (Upload.Form("updateProduct"))
deleteProduct = TRIM (Upload.Form("deleteProduct"))
'response.write("delete=" & deleteProduct)
delID = TRIM (Upload.Form("delID"))
catID = TRIM (Upload.Form("catID"))
artTitle = TRIM (Upload.Form("artTitle"))
artCategory = TRIM (Upload.Form("artCategory"))
artBriefDesc = TRIM (Upload.Form("artBriefDesc"))
artPrice = TRIM (Upload.Form("artPrice"))
artPicFull = TRIM (arr(1))
artFace = TRIM (arr(2))
artHood = TRIM (arr(3))
artExtra1 = TRIM (arr(4))
artExtra2 = TRIM (arr(5))
artExtra3 = TRIM (arr(6))
artCaseDesc = TRIM (Upload.Form("artCaseDesc"))
artDialDesc = TRIM (Upload.Form("artDialDesc"))
artMovementDesc = TRIM (Upload.Form("artMovementDesc"))
artMakerDesc = TRIM (Upload.Form("artMakerDesc"))
artDatDesc = TRIM (Upload.Form("artDatDesc"))
artHeightDesc = TRIM (Upload.Form("artHeightDesc"))
artStatus = TRIM (Upload.Form("artStatus"))
artMoonDisplay = TRIM (Upload.Form("artMoonDisplay"))
artDisplay = TRIM (Upload.Form("artDisplay"))
origImage = TRIM(upload.Form("origImage"))
origFImage = TRIM(upload.Form("origFImage"))
origHImage = TRIM(upload.Form("origHImage"))
origExtra1 = TRIM(upload.Form("origExtra1"))
origExtra2 = TRIM(upload.Form("origExtra2"))
origExtra3 = TRIM(upload.Form("origExtra3"))
set upload = nothing
'Assign Default Values
IF artTitle = "" THEN
artTitle = "?????"
END IF
IF artCategory = "" THEN
artCategory = "?????"
END IF
IF artBriefDesc = "" THEN
artBriefDesc = "?????"
END IF
IF artPrice = "" THEN
artPrice = "?????"
END IF
IF artCaseDesc = "" THEN
artCaseDesc = "?????"
END IF
IF artDialDesc = "" THEN
artDialDesc = "?????"
END IF
IF artMovementDesc = "" THEN
artMovementDesc = "?????"
END IF
IF artMakerDesc = "" THEN
artMakerDesc = "?????"
END IF
IF artDatDesc = "" THEN
artDatDesc = "?????"
END IF
IF artHeightDesc = "" THEN
artHeightDesc = "?????"
END IF
IF artStatus = "" THEN
artStatus = "?????"
END IF
IF artMoonDisplay = "" THEN
artMoonDisplay = "?????"
END IF
IF artDisplay = "" THEN
artDisplay = "?????"
END IF
' Add new product
if artPicFull = "" then
Pimage = origImage
else
Pimage = artPicFull
end if
if artFace = "" then
Fimage = origFImage
else
Fimage = artFace
end if
if artHood = "" then
Himage = origHImage
else
Himage = artHood
end if
if artExtra1 = "" then
Extra1 = origExtra1
else
Extra1 = artExtra1
end if
if artExtra2 = "" then
Extra2 = origExtra2
else
Extra2 = artExtra2
end if
if artExtra3 = "" then
Extra3 = origExtra3
else
Extra3 = artExtra3
end if
if addProduct <> "" then
strsqlM = "INSERT INTO eventDisplay " &_
"( art_Title, art_Category, art_BDescription, art_Price, art_ThumbFull, art_ThumbFace, art_ThumbHood, image_Extra1, image_Extra2, image_Extra3, case_Text, dial_Text, movement_Text, maker_Text, dat_Text, height_Text, art_Status, art_MoonDisplay, art_Display ) VALUES (" &_
" '" & fixQuotes (artTitle ) & "', " &_
" '" & fixQuotes (artCategory ) & "', " &_
" '" & fixQuotes (artBriefDesc ) & "', " &_
" '" & fixQuotes (artPrice ) & "', " &_
" '" & fixQuotes (artPicFull ) & "', " &_
" '" & fixQuotes (artFace ) & "', " &_
" '" & fixQuotes (artHood ) & "', " &_
" '" & fixQuotes (artExtra1 ) & "', " &_
" '" & fixQuotes (artExtra2 ) & "', " &_
" '" & fixQuotes (artExtra3 ) & "', " &_
" '" & fixQuotes (artCaseDesc ) & "', " &_
" '" & fixQuotes (artDialDesc ) & "', " &_
" '" & fixQuotes (artMovementDesc ) & "', " &_
" '" & fixQuotes (artMakerDesc ) & "', " &_
" '" & fixQuotes (artDatDesc ) & "', " &_
" '" & fixQuotes (artHeightDesc ) & "', " &_
" '" & fixQuotes (artStatus ) & "', " &_
" " & fixQuotes (artMoonDisplay ) & ", " &_
" " & fixQuotes (artDisplay ) & " )"
'rsuser.open strsql, conn
On Error Resume Next
ConnM.Execute strsqlM
If Err <> 0 Then
Response.Write "Error in query " & strsqlM
Response.End
End If
end if
%>
<style type="text/css">
<!--
.style2 {
color: #FF3400;
font-weight: bold;
}
-->
</style>
<center>
<br>
<table width="600" border="1" cellpadding="4"
cellspacing ="0" bgcolor="white">
<tr>
<td width="161"><strong>Clock Title:</strong></td>
<td width="417"><b><%=artTitle%></b> </td>
</tr>
<tr>
<td height="29"><strong>Category: </strong></td>
<td><b><%=artCategory%></b></td>
</tr>
<tr>
<td height="29"><strong>Brief Description:</strong></td>
<td><b><%=artBriefDesc%></b></td>
</tr>
<tr>
<td height="29"><strong>Price:</strong></td>
<td><b><%=artPrice%></b></td>
</tr>
<tr>
<td height="29"><strong>Picture of full length:</strong></td>
<td><b><%=Pimage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Picture of the face:</strong></td>
<td><b><%=Fimage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Picture of the hood:</strong></td>
<td><b><%=Himage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 1:</strong></td>
<td><b><%=Extra1%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 2:</strong></td>
<td><b><%=Extra2%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 3:</strong></td>
<td><b><%=Extra3%> </b></td>
</tr>
<tr>
<td height="29"><strong>Case Description:</strong></td>
<td><b><%=artCaseDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Dial Description:</strong></td>
<td><b><%=artDialDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Movement Description:</strong></td>
<td><b><%=artMovementDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Maker Description:</strong></td>
<td><b><%=artMakerDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Date Description:</strong></td>
<td><b><%=artDatDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Height Description:</strong></td>
<td><b><%=artHeightDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Status:</strong></td>
<td><br>
<b><%=artStatus%></b> </td>
</tr>
<tr>
<td height="29"><strong>Moon Display:</strong></td>
<td><b><%=artMoonDisplay%> </b></td>
</tr>
<tr>
<td height="29"><strong>Display:</strong></td>
<td><br>
<b><%=artDisplay%></b> </td>
</tr>
<tr>
<td height="29"> </td>
<td><br/><span class="style2">Was added to the database</span> </td>
</tr>
</table>
</center>
<p>
<%
end if
%>
<%
' Update Product
IF updateProduct <> "" THEN
if artPicFull = "" then
Pimage = origImage
else
Pimage = artPicFull
end if
if artFace = "" then
Fimage = origFImage
else
Fimage = artFace
end if
if artHood = "" then
Himage = origHImage
else
Himage = artHood
end if
if artExtra1 = "" then
Extra1 = origExtra1
else
Extra1 = artExtra1
end if
if artExtra2 = "" then
Extra2 = origExtra2
else
Extra2 = artExtra2
end if
if artExtra3 = "" then
Extra3 = origExtra3
else
Extra3 = artExtra3
end if
if artTitle = "" then
strsqlM = "UPDATE eventDisplay SET " &_
"art_Category='" & fixQuotes( artCategory ) & "', " &_
"art_BDescription='" & fixQuotes( artBriefDesc ) & "', " &_
"art_Price='" & fixQuotes( artPrice ) & "', " &_
"art_ThumbFull='" & fixQuotes( Pimage ) & "', " &_
"art_ThumbFace='" & fixQuotes( Fimage ) & "', " &_
"art_ThumbHood='" & fixQuotes( Himage ) & "', " &_
"image_Extra1='" & fixQuotes( Extra1 ) & "', " &_
"image_Extra2='" & fixQuotes( Extra2 ) & "', " &_
"image_Extra3='" & fixQuotes( Extra3 ) & "', " &_
"case_Text='" & fixQuotes(artCaseDesc ) & "', " &_
"dial_Text='" & fixQuotes(artDialDesc ) & "', " &_
"movement_Text='" & fixQuotes(artMovementDesc ) & "', " &_
"maker_Text='" & fixQuotes(artMakerDesc ) & "', " &_
"dat_Text='" & fixQuotes(artDatDesc ) & "', " &_
"height_Text='" & fixQuotes(artHeightDesc ) & "', " &_
"art_Status='" & fixQuotes( artStatus ) & "', " &_
"art_MoonDisplay=" & artMoonDisplay & ", " &_
"art_Display=" & artDisplay & " " &_
" WHERE " &_
"cat_ID=" & catID
else
strsqlM = "UPDATE eventDisplay SET " &_
"art_Title='" & fixQuotes( artTitle ) & "', " &_
"art_Category='" & fixQuotes( artCategory ) & "', " &_
"art_BDescription='" & fixQuotes( artBriefDesc ) & "', " &_
"art_Price='" & fixQuotes(artPrice ) & "', " &_
"art_ThumbFull='" & fixQuotes( Pimage ) & "', " &_
"art_ThumbFace='" & fixQuotes( Fimage ) & "', " &_
"art_ThumbHood='" & fixQuotes( Himage ) & "', " &_
"image_Extra1='" & fixQuotes( Extra1 ) & "', " &_
"image_Extra2='" & fixQuotes( Extra2 ) & "', " &_
"image_Extra3='" & fixQuotes( Extra3 ) & "', " &_
"case_Text='" & fixQuotes(artCaseDesc ) & "', " &_
"dial_Text='" & fixQuotes(artDialDesc ) & "', " &_
"movement_Text='" & fixQuotes(artMovementDesc ) & "', " &_
"maker_Text='" & fixQuotes(artMakerDesc ) & "', " &_
"dat_Text='" & fixQuotes(artDatDesc ) & "', " &_
"height_Text='" & fixQuotes(artHeightDesc ) & "', " &_
"art_Status='" & fixQuotes( artStatus ) & "', " &_
"art_MoonDisplay=" & artMoonDisplay & ", " &_
"art_Display=" & artDisplay & " " &_
" WHERE " &_
"cat_ID=" & catID
end if
ConnM.Execute strsqlM
%>
<center>
<table width="600" cellpadding="4"
cellspacing="0" >
<tr>
<td>
<%=artTitle%> was updated in the database
<br/>
<br/>
</td>
</tr>
</table>
</center>
<%
END IF
%>
<center>
<table width="600" border="1" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2"><strong>
Edit Clock Information - </strong>If you want to edit information of a specific clock use the section below to select the Clock Title:</td>
</tr>
<tr>
<td align="center">
<table border="1" size="400" cellpadding="3" cellspacing="0">
<%
strsqlM = "SELECT cat_ID, art_Title, art_Category FROM eventDisplay " &_
"ORDER BY cat_ID DESC"
set rs = server.createobject("adodb.recordset")
rs.activeconnection = ConnM
rs.open strsqlM
WHILE NOT rs.EOF
%>
<tr>
<td>
<a href="updateproduct_art.asp?pid=<%=rs( "cat_ID")%>"><%=rs( "art_Title" )%> - <%=rs( "art_Category" )%></a>
</td>
</tr>
<% rs.MoveNext
WEND
rs.close
set rs = nothing
ConnM.close
set ConnM = nothing
%>
I have 6 images that are uploaded fine via a 'add product' page, then when I go to my edit page and for example change 1 of those images of the 6 and upload that, I get problems, but all is fine if when im in the 'edit' page I change another piece of data and submit.
I have included below the 2 pages that are used when 'editing' a selection.
IF NOT rsuserU.EOF THEN
artTitle = rsuserU( "art_Title" )
artCategory = rsuserU( "art_Category" )
artBriefDesc = rsuserU( "art_BDescription" )
artPrice = rsuserU( "art_Price" )
artPicFull = rsuserU( "art_ThumbFull" )
artFace = rsuserU( "art_ThumbFace" )
artHood = rsuserU( "art_ThumbHood" )
artExtra1 = rsuserU( "image_Extra1" )
artExtra2 = rsuserU( "image_Extra2" )
artExtra3 = rsuserU( "image_Extra3" )
artCaseDesc = rsuserU( "case_Text" )
artDialDesc = rsuserU( "dial_Text" )
artMovementDesc = rsuserU( "movement_Text" )
artMakerDesc = rsuserU( "maker_Text" )
artDatDesc = rsuserU( "dat_Text" )
artHeightDesc = rsuserU( "height_Text" )
artStatus = rsuserU( "art_Status" )
artMoonDisplay = rsuserU( "art_MoonDisplay" )
artDisplay = rsuserU( "art_Display" )
END IF
rsuserU.Close
FUNCTION SELECTED( firstVal, secondVal )
IF cSTR( firstVal ) = cSTR( secondVal ) THEN
SELECTED = " SELECTED "
END IF
END FUNCTION
%>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
.style2 {color: #FFFFFF}
-->
</style>
<body bgcolor="White">
<span class="style2">
<form method="post" enctype="multipart/form-data" action="manageproducts_art.asp">
<center>
<table width="700" border="1" bgcolor="White" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" bgcolor="yellow"><b>
Edit or Update Clock Information: </b>
</td>
</tr>
<tr>
<td><b>Title:</b>
</td>
<td><input name="artTitle" size="50" maxlength="50" value="<%=Server.HTMLEncode( artTitle )%>">
</td>
</tr>
<tr>
<td><b>Category:</b>
</td>
<td> <select name="artCategory">
<option value="Longcase Mahogany" <%=SELECTED( "Longcase Mahogany", artCategory )%>>Longcase Mahogany
<option value="Longcase Oak" <%=SELECTED( "Longcase Oak", artCategory )%>>Longcase Oak
<option value="Longcase Walnut" <%=SELECTED( "Longcase Walnut", artCategory )%>>Longcase Walnut
<option value="Longcase Marquetry" <%=SELECTED( "Longcase Marquetry", artCategory )%>>Longcase Marquetry
<option value="Longcase Lacquer" <%=SELECTED( "Longcase Lacquer", artCategory )%>>Longcase Lacquer
<option value="Longcase Miscellaneous" <%=SELECTED( "Longcase Miscellaneous", artCategory )%>>Longcase Miscellaneous
<option value="Other clocks and instruments" <%=SELECTED( "Other clocks and instruments", artCategory )%>>Other clocks and instruments
<option value="Barometers" <%=SELECTED( "Barometers", artCategory )%>>Barometers
<option value="Restoration" <%=SELECTED( "Restoration", artCategory )%>>Restoration
<option value="Longcase Mahogany Archive" <%=SELECTED( "Longcase Mahogany Archive", artCategory )%>>Longcase Mahogany Archive
<option value="Longcase Oak Archive" <%=SELECTED( "Longcase Oak Archive", artCategory )%>>Longcase Oak Archive
<option value="Longcase Walnut Archive" <%=SELECTED( "Longcase Walnut Archive", artCategory )%>>Longcase Walnut Archive
<option value="Longcase Marquetry Archive" <%=SELECTED( "Longcase Marquetry Archive", artCategory )%>>Longcase Marquetry Archive
<option value="Longcase Lacquer Archive" <%=SELECTED( "Longcase Lacquer Archive", artCategory )%>>Longcase Lacquer Archive
<option value="Longcase Miscellaneous Archive" <%=SELECTED( "Longcase Miscellaneous Archive", artCategory )%>>Longcase Miscellaneous Archive
<option value="Other clocks and instruments Archive" <%=SELECTED( "Other clocks and instruments Archive", artCategory )%>>Other clocks and instruments Archive
<option value="Barometers Archive" <%=SELECTED( "Barometers Archive", artCategory )%>>Barometers Archive
</select></td>
</tr>
<tr>
<tr>
<td><b>Brief Description:</b>
</td>
<td><textarea name="artBriefDesc" cols="50" rows="5"><%=Server.HTMLEncode( artBriefDesc )%></textarea>
</td>
</tr>
<tr>
<tr>
<td><b>Price:</b>
</td>
<td><input name="artPrice" size="50" maxlength="50" value="<%=Server.HTMLEncode( artPrice )%>">
</td>
</tr>
<tr>
<td bgcolor="#990000"><span class="style1">Please note!</span> </td>
<td bgcolor="#990000"><span class="style1">When changing an image, you have to change or re-load all 6 </span></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Full Length Clock Picture:</b></td>
<td><strong><%=Server.HTMLEncode( artPicFull )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Full Length Clock Picture:</b> </td>
<td><input name="artPicFull" size="50" type="file" /></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Clock Face Picture:</b> </td>
<td><strong><%=Server.HTMLEncode( artFace )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Clock Face Picture:</b> </td>
<td><input name="artFace" size="50" type="file" /></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Clock Hood Picture:</b> </td>
<td><strong><%=Server.HTMLEncode( artHood )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Clock Hood Picture:</b> </td>
<td><input name="artHood" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 1:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra1 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 1:</b> </td>
<td><input name="artExtra1" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 2:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra2 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 2:</b> </td>
<td><input name="artExtra2" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>Current Extra Picture 3:</b> </td>
<td><strong><%=Server.HTMLEncode( artExtra3 )%> </strong></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><b>New Extra Picture 3:</b> </td>
<td><input name="artExtra3" size="50" type="file"></td>
</tr>
<tr>
<td bgcolor="#990000"><span class="style1">Please note!</span> </td>
<td bgcolor="#990000"><span class="style1">When changing an image, you have to change or re-load all 6</span></td>
</tr>
<tr>
<td><b>Case Description:</b>
</td>
<td><textarea name="artCaseDesc" cols="50" rows="5"><%=Server.HTMLEncode( artCaseDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Dial Description:</b>
</td>
<td><textarea name="artDialDesc" cols="50" rows="5"><%=Server.HTMLEncode( artDialDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Movement Description:</b>
</td>
<td><textarea name="artMovementDesc" cols="50" rows="5"><%=Server.HTMLEncode( artMovementDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Maker Description:</b>
</td>
<td><textarea name="artMakerDesc" cols="50" rows="5"><%=Server.HTMLEncode( artMakerDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Date Description:</b>
</td>
<td><textarea name="artDatDesc" cols="50" rows="5"><%=Server.HTMLEncode( artDatDesc )%></textarea>
</td>
</tr>
<tr>
<td><b>Height Description:</b>
</td>
<td><textarea name="artHeightDesc" cols="50" rows="5"><%=Server.HTMLEncode( artHeightDesc )%></textarea>
</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td><select name=artStatus id="select">
<option value="IN STOCK" <%=SELECTED( "IN STOCK", artStatus )%>>IN STOCK
<option value="SOLD" <%=SELECTED( "SOLD", artStatus )%>>SOLD
</select></td>
</tr>
<tr>
<td><strong>Moon Image Display:</strong></td>
<td><select name=artMoonDisplay id="select">
<option value="1" <%=SELECTED( "1", artMoonDisplay )%>>YES
<option value="0" <%=SELECTED( "0", artMoonDisplay )%>>NO
</select></td>
</tr>
<tr>
<td><strong>Display:</strong></td>
<td><select name=artDisplay id="select">
<option value="1" <%=SELECTED( "1", artDisplay )%>>YES
<option value="0" <%=SELECTED( "0", artDisplay )%>>NO
</select></td>
</tr>
<tr>
<tr>
<td><a href="../adminPage.asp">Back </a></td>
<td><div align="right">
<input type="hidden" name="origImage" value="<%=Server.HTMLEncode( artPicFull )%>" />
<input type="hidden" name="origFImage" value="<%=Server.HTMLEncode( artFace )%>" />
<input type="hidden" name="origHImage" value="<%=Server.HTMLEncode( artHood )%>" />
<input type="hidden" name="origExtra1" value="<%=Server.HTMLEncode( artExtra1 )%>" />
<input type="hidden" name="origExtra2" value="<%=Server.HTMLEncode( artExtra2 )%>" />
<input type="hidden" name="origExtra3" value="<%=Server.HTMLEncode( artExtra3 )%>" />
<input name="catID" type="hidden" value="<%=catID%>">
<input name="updateProduct" type="hidden" value="1">
<input name="submit" type="submit" value="submit">
</div></td>
</tr>
</table>
</center>
</form>
This is then submitted here:
if instr(Trim(Request.ServerVariables("HTTP_REFERER")),"addproduct_art.asp") or instr(Trim(Request.ServerVariables("HTTP_REFERER")),"updateproduct_art.asp") then
Set Upload = Server.CreateObject("Persits.Upload")
theCount = upload.save(server.mappath("..")&"\images\uploaded")
dim arr(6), i
i = 1
For Each File in Upload.Files
arr(i) = File.FileName
i = i + 1
Next
'Count = Upload.SaveVirtual("../upload")
' Get the form variables
addProduct = TRIM (Upload.Form("addProduct"))
updateProduct = TRIM (Upload.Form("updateProduct"))
deleteProduct = TRIM (Upload.Form("deleteProduct"))
'response.write("delete=" & deleteProduct)
delID = TRIM (Upload.Form("delID"))
catID = TRIM (Upload.Form("catID"))
artTitle = TRIM (Upload.Form("artTitle"))
artCategory = TRIM (Upload.Form("artCategory"))
artBriefDesc = TRIM (Upload.Form("artBriefDesc"))
artPrice = TRIM (Upload.Form("artPrice"))
artPicFull = TRIM (arr(1))
artFace = TRIM (arr(2))
artHood = TRIM (arr(3))
artExtra1 = TRIM (arr(4))
artExtra2 = TRIM (arr(5))
artExtra3 = TRIM (arr(6))
artCaseDesc = TRIM (Upload.Form("artCaseDesc"))
artDialDesc = TRIM (Upload.Form("artDialDesc"))
artMovementDesc = TRIM (Upload.Form("artMovementDesc"))
artMakerDesc = TRIM (Upload.Form("artMakerDesc"))
artDatDesc = TRIM (Upload.Form("artDatDesc"))
artHeightDesc = TRIM (Upload.Form("artHeightDesc"))
artStatus = TRIM (Upload.Form("artStatus"))
artMoonDisplay = TRIM (Upload.Form("artMoonDisplay"))
artDisplay = TRIM (Upload.Form("artDisplay"))
origImage = TRIM(upload.Form("origImage"))
origFImage = TRIM(upload.Form("origFImage"))
origHImage = TRIM(upload.Form("origHImage"))
origExtra1 = TRIM(upload.Form("origExtra1"))
origExtra2 = TRIM(upload.Form("origExtra2"))
origExtra3 = TRIM(upload.Form("origExtra3"))
set upload = nothing
'Assign Default Values
IF artTitle = "" THEN
artTitle = "?????"
END IF
IF artCategory = "" THEN
artCategory = "?????"
END IF
IF artBriefDesc = "" THEN
artBriefDesc = "?????"
END IF
IF artPrice = "" THEN
artPrice = "?????"
END IF
IF artCaseDesc = "" THEN
artCaseDesc = "?????"
END IF
IF artDialDesc = "" THEN
artDialDesc = "?????"
END IF
IF artMovementDesc = "" THEN
artMovementDesc = "?????"
END IF
IF artMakerDesc = "" THEN
artMakerDesc = "?????"
END IF
IF artDatDesc = "" THEN
artDatDesc = "?????"
END IF
IF artHeightDesc = "" THEN
artHeightDesc = "?????"
END IF
IF artStatus = "" THEN
artStatus = "?????"
END IF
IF artMoonDisplay = "" THEN
artMoonDisplay = "?????"
END IF
IF artDisplay = "" THEN
artDisplay = "?????"
END IF
' Add new product
if artPicFull = "" then
Pimage = origImage
else
Pimage = artPicFull
end if
if artFace = "" then
Fimage = origFImage
else
Fimage = artFace
end if
if artHood = "" then
Himage = origHImage
else
Himage = artHood
end if
if artExtra1 = "" then
Extra1 = origExtra1
else
Extra1 = artExtra1
end if
if artExtra2 = "" then
Extra2 = origExtra2
else
Extra2 = artExtra2
end if
if artExtra3 = "" then
Extra3 = origExtra3
else
Extra3 = artExtra3
end if
if addProduct <> "" then
strsqlM = "INSERT INTO eventDisplay " &_
"( art_Title, art_Category, art_BDescription, art_Price, art_ThumbFull, art_ThumbFace, art_ThumbHood, image_Extra1, image_Extra2, image_Extra3, case_Text, dial_Text, movement_Text, maker_Text, dat_Text, height_Text, art_Status, art_MoonDisplay, art_Display ) VALUES (" &_
" '" & fixQuotes (artTitle ) & "', " &_
" '" & fixQuotes (artCategory ) & "', " &_
" '" & fixQuotes (artBriefDesc ) & "', " &_
" '" & fixQuotes (artPrice ) & "', " &_
" '" & fixQuotes (artPicFull ) & "', " &_
" '" & fixQuotes (artFace ) & "', " &_
" '" & fixQuotes (artHood ) & "', " &_
" '" & fixQuotes (artExtra1 ) & "', " &_
" '" & fixQuotes (artExtra2 ) & "', " &_
" '" & fixQuotes (artExtra3 ) & "', " &_
" '" & fixQuotes (artCaseDesc ) & "', " &_
" '" & fixQuotes (artDialDesc ) & "', " &_
" '" & fixQuotes (artMovementDesc ) & "', " &_
" '" & fixQuotes (artMakerDesc ) & "', " &_
" '" & fixQuotes (artDatDesc ) & "', " &_
" '" & fixQuotes (artHeightDesc ) & "', " &_
" '" & fixQuotes (artStatus ) & "', " &_
" " & fixQuotes (artMoonDisplay ) & ", " &_
" " & fixQuotes (artDisplay ) & " )"
'rsuser.open strsql, conn
On Error Resume Next
ConnM.Execute strsqlM
If Err <> 0 Then
Response.Write "Error in query " & strsqlM
Response.End
End If
end if
%>
<style type="text/css">
<!--
.style2 {
color: #FF3400;
font-weight: bold;
}
-->
</style>
<center>
<br>
<table width="600" border="1" cellpadding="4"
cellspacing ="0" bgcolor="white">
<tr>
<td width="161"><strong>Clock Title:</strong></td>
<td width="417"><b><%=artTitle%></b> </td>
</tr>
<tr>
<td height="29"><strong>Category: </strong></td>
<td><b><%=artCategory%></b></td>
</tr>
<tr>
<td height="29"><strong>Brief Description:</strong></td>
<td><b><%=artBriefDesc%></b></td>
</tr>
<tr>
<td height="29"><strong>Price:</strong></td>
<td><b><%=artPrice%></b></td>
</tr>
<tr>
<td height="29"><strong>Picture of full length:</strong></td>
<td><b><%=Pimage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Picture of the face:</strong></td>
<td><b><%=Fimage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Picture of the hood:</strong></td>
<td><b><%=Himage%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 1:</strong></td>
<td><b><%=Extra1%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 2:</strong></td>
<td><b><%=Extra2%> </b></td>
</tr>
<tr>
<td height="29"><strong>Extra Image 3:</strong></td>
<td><b><%=Extra3%> </b></td>
</tr>
<tr>
<td height="29"><strong>Case Description:</strong></td>
<td><b><%=artCaseDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Dial Description:</strong></td>
<td><b><%=artDialDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Movement Description:</strong></td>
<td><b><%=artMovementDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Maker Description:</strong></td>
<td><b><%=artMakerDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Date Description:</strong></td>
<td><b><%=artDatDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Height Description:</strong></td>
<td><b><%=artHeightDesc%> </b></td>
</tr>
<tr>
<td height="29"><strong>Status:</strong></td>
<td><br>
<b><%=artStatus%></b> </td>
</tr>
<tr>
<td height="29"><strong>Moon Display:</strong></td>
<td><b><%=artMoonDisplay%> </b></td>
</tr>
<tr>
<td height="29"><strong>Display:</strong></td>
<td><br>
<b><%=artDisplay%></b> </td>
</tr>
<tr>
<td height="29"> </td>
<td><br/><span class="style2">Was added to the database</span> </td>
</tr>
</table>
</center>
<p>
<%
end if
%>
<%
' Update Product
IF updateProduct <> "" THEN
if artPicFull = "" then
Pimage = origImage
else
Pimage = artPicFull
end if
if artFace = "" then
Fimage = origFImage
else
Fimage = artFace
end if
if artHood = "" then
Himage = origHImage
else
Himage = artHood
end if
if artExtra1 = "" then
Extra1 = origExtra1
else
Extra1 = artExtra1
end if
if artExtra2 = "" then
Extra2 = origExtra2
else
Extra2 = artExtra2
end if
if artExtra3 = "" then
Extra3 = origExtra3
else
Extra3 = artExtra3
end if
if artTitle = "" then
strsqlM = "UPDATE eventDisplay SET " &_
"art_Category='" & fixQuotes( artCategory ) & "', " &_
"art_BDescription='" & fixQuotes( artBriefDesc ) & "', " &_
"art_Price='" & fixQuotes( artPrice ) & "', " &_
"art_ThumbFull='" & fixQuotes( Pimage ) & "', " &_
"art_ThumbFace='" & fixQuotes( Fimage ) & "', " &_
"art_ThumbHood='" & fixQuotes( Himage ) & "', " &_
"image_Extra1='" & fixQuotes( Extra1 ) & "', " &_
"image_Extra2='" & fixQuotes( Extra2 ) & "', " &_
"image_Extra3='" & fixQuotes( Extra3 ) & "', " &_
"case_Text='" & fixQuotes(artCaseDesc ) & "', " &_
"dial_Text='" & fixQuotes(artDialDesc ) & "', " &_
"movement_Text='" & fixQuotes(artMovementDesc ) & "', " &_
"maker_Text='" & fixQuotes(artMakerDesc ) & "', " &_
"dat_Text='" & fixQuotes(artDatDesc ) & "', " &_
"height_Text='" & fixQuotes(artHeightDesc ) & "', " &_
"art_Status='" & fixQuotes( artStatus ) & "', " &_
"art_MoonDisplay=" & artMoonDisplay & ", " &_
"art_Display=" & artDisplay & " " &_
" WHERE " &_
"cat_ID=" & catID
else
strsqlM = "UPDATE eventDisplay SET " &_
"art_Title='" & fixQuotes( artTitle ) & "', " &_
"art_Category='" & fixQuotes( artCategory ) & "', " &_
"art_BDescription='" & fixQuotes( artBriefDesc ) & "', " &_
"art_Price='" & fixQuotes(artPrice ) & "', " &_
"art_ThumbFull='" & fixQuotes( Pimage ) & "', " &_
"art_ThumbFace='" & fixQuotes( Fimage ) & "', " &_
"art_ThumbHood='" & fixQuotes( Himage ) & "', " &_
"image_Extra1='" & fixQuotes( Extra1 ) & "', " &_
"image_Extra2='" & fixQuotes( Extra2 ) & "', " &_
"image_Extra3='" & fixQuotes( Extra3 ) & "', " &_
"case_Text='" & fixQuotes(artCaseDesc ) & "', " &_
"dial_Text='" & fixQuotes(artDialDesc ) & "', " &_
"movement_Text='" & fixQuotes(artMovementDesc ) & "', " &_
"maker_Text='" & fixQuotes(artMakerDesc ) & "', " &_
"dat_Text='" & fixQuotes(artDatDesc ) & "', " &_
"height_Text='" & fixQuotes(artHeightDesc ) & "', " &_
"art_Status='" & fixQuotes( artStatus ) & "', " &_
"art_MoonDisplay=" & artMoonDisplay & ", " &_
"art_Display=" & artDisplay & " " &_
" WHERE " &_
"cat_ID=" & catID
end if
ConnM.Execute strsqlM
%>
<center>
<table width="600" cellpadding="4"
cellspacing="0" >
<tr>
<td>
<%=artTitle%> was updated in the database
<br/>
<br/>
</td>
</tr>
</table>
</center>
<%
END IF
%>
<center>
<table width="600" border="1" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2"><strong>
Edit Clock Information - </strong>If you want to edit information of a specific clock use the section below to select the Clock Title:</td>
</tr>
<tr>
<td align="center">
<table border="1" size="400" cellpadding="3" cellspacing="0">
<%
strsqlM = "SELECT cat_ID, art_Title, art_Category FROM eventDisplay " &_
"ORDER BY cat_ID DESC"
set rs = server.createobject("adodb.recordset")
rs.activeconnection = ConnM
rs.open strsqlM
WHILE NOT rs.EOF
%>
<tr>
<td>
<a href="updateproduct_art.asp?pid=<%=rs( "cat_ID")%>"><%=rs( "art_Title" )%> - <%=rs( "art_Category" )%></a>
</td>
</tr>
<% rs.MoveNext
WEND
rs.close
set rs = nothing
ConnM.close
set ConnM = nothing
%>