<%@ Language=VBScript %> <%Response.Buffer=True%> <%SET upl=Server.CreateObject("SoftArtisans.FileUp") IPath= Server.MapPath("\") & "\Uploads\ProductImages\" upl.Path=Server.MapPath("\") & "\Uploads\ProductImages\" %> <% Updated = Request.QueryString("Updated") %> <% PageTitle = "SiteManager - New Product Images" %> <% PageID=257 %> <% Header %> <% Menu PageID %> <%' Main body of page goes here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %> <%UProductImages%> <%' End Of Main body ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %> <% Footer %> <% Sub UProductImages message="" tmessage="" OpenConnection1 ProdID = Request.QueryString("PID") If upl.Form("chkDelete")="deletemain" then SET del=Server.CreateObject("SoftArtisans.SAFile") SET rs=Server.CreateObject("ADODB.Recordset") SEL="SELECT txtImage FROM UProducts WHERE ProductID=" & ProdID rs.Open SEL,DB,1,3 If rs("txtImage")<>"" then del.Delete IPath & rs("txtImage") rs("txtImage")="" rs.Update rs.Close Response.Redirect("UProduct_Images.asp?PID="&ProdID) Else expire="There is no image to delete!" End If End If If upl.Form("chkDelete")="" AND upl.Form("hidSave")="True" then NewFileName = Mid(upl.form("f1").UserFilename, InstrRev(upl.form("f1").UserFilename, "\") + 1) NewFileName="u"&ProdID&NewFileName PIC = "SELECT * FROM UProducts WHERE ProductID=" & ProdID SET rs=Server.CreateObject("ADODB.Recordset") rs.Open PIC,DB,1,3 If rs.EOF then rs.Close Response.Redirect("UProduct_List.asp") ElseIf rs("txtImage")<>"" then If NewFileName <> rs("txtImage") then If upl.IsEmpty then expire="The file that you uploaded was empty or unreadable. Please try again." rs.Close Else upl.Form("f1").SaveAs NewFileName upl.Delete IPath & rs("txtImage") rs("txtImage")= NewFileName rs.Update rs.Close Response.Redirect("UProduct_Images.asp?PID="&ProdID) End If Else expire="You cannot replace an image with an image of the same name - please rename the new image before uploading!" rs.Close End If Else If upl.IsEmpty then expire="The file that you uploaded was empty or unreadable. Please try again." rs.Close Else upl.Form("f1").SaveAs NewFileName rs("txtImage")= NewFileName rs.Update rs.Close Response.Redirect("UProduct_Images.asp?PID="&ProdID) End If End If End If PIC = "SELECT txtProduct,txtImage FROM UProducts WHERE ProductID=" & ProdID SET rs=Server.CreateObject("ADODB.Recordset") rs.Open PIC,DB,1,3 If rs.EOF then expire="The associated product has been deleted - return to the Product List!" If rs("txtImage")<>"" then txtImage=rs("txtImage") Else message="There is currently no image associated with this product!" End If txtProduct=DisPrepText(rs("txtProduct")) rs.Close%>

<%= FormatDateTime(Date,1) %>

<%If expire<>"" then%>

<%=expire%>
<%End If%>

<%=txtProduct%>


Product Image: <%If txtImage<>"" then%>

<%Else%>

<%=message%>
<%End If%>

Enter the filename and full path below for the image you wish to upload as the main product image or select browse to locate the file.


Check this box and click save to clear image


<%End Sub%>