<% if trim(pht_type)="gal" then M_UAdd = fun_chkRight("Gallery","A") else M_UAdd = fun_chkRight("Testimonial","A") end if if M_UAdd = 0 then %> <% response.end end if %> <% Function fixquotes(theString) fixquotes = Replace(theString,"'","''") End Function EMsg = "" Dim Uploader, File Set Uploader = New FileUploader ' This starts the upload process Uploader.Upload() pht_type = fixquotes(Trim(Uploader.Form("pht_type"))) galid = fixquotes(Trim(Uploader.Form("galid"))) heading = fixquotes(Trim(Uploader.Form("heading"))) testimonial = fixquotes(Trim(Uploader.Form("testimonial"))) display = fixquotes(Trim(Uploader.Form("display"))) if trim(pht_type)="gal" then img_prefix="pg" p_dir="images\gallery\" repage = "phtV" pgtitle = "Add Photos" if trim(galid) = 0 then EMsg = EMsg & "   * * Please select photo gallery
" If Uploader.Files.Count <= 0 Then EMsg = EMsg & "   * * Please select image
" elseif trim(pht_type)="testi" then img_prefix="tm" p_dir="images\testimony\" repage = "temV" pgtitle = "Add Testimonials" if trim(heading) = "" then EMsg = EMsg & "   * * Please enter Testmony By
" if trim(testimonial) = "" then EMsg = EMsg & "   * * Please enter testimony
" else EMsg = EMsg & "   * * Please try again
" end if pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-16 FilePath = Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & p_dir ' response.write FilePath ' response.end ' elseif len(heading) > 500 then ' EMsg = EMsg & "   * * Please enter article headline less than 500 characters
" ' end if if trim(pht_type)="testi" then strSQL = "select a.photoid from photos a where a.heading = '" & heading & "'" rs.Open strSQL, con, 3, 3 if not rs.EOF Then EMsg = "   * * Testimony by already exists" end if rs.Close end if if Trim(EMsg) = "" Then heading = replace(trim(heading),vbcrlf,"
") testimonial = replace(trim(testimonial),vbcrlf,"
") logdate = date() & " " & time() con.BeginTrans strSQL = "insert into photos (galid, heading, testimonial, display, logdate, updated) values ("& galid & ", '" & heading & "', '" & testimonial & "', '" & display & "', '" & logdate & "', '" & logdate & "')" 'response.write strSQL 'response.end con.Execute(strSQL) strSQL = "select top 1 photoid from photos order by photoid desc" rs.Open strSQL, con, 3, 3 if not rs.EOF Then photoid = rs("photoid") end if rs.close newfile = "" If Uploader.Files.Count > 0 Then Set o_FS = Server.CreateObject("Scripting.FileSystemObject") For Each File In Uploader.Files.Items nowFile = img_prefix & photoid newfile = nowFile & "." & o_FS.GetExtensionName(File.FileName) ' Save file File.SaveToLocation FilePath , newfile strSQL = "update photos set photonm = '"& newfile &"' where photoid="&photoid con.Execute(strSQL) Next Set o_FS = Nothing if trim(pht_type)="gal" and trim(newfile) <>"" then strSQL = "update photo_gallary set imgname = '"& newfile &"' where galid = " & galid con.Execute(strSQL) end if end if 'if files.count>0 con.CommitTrans end if set rs = nothing con.Close set con = nothing if Trim(EMsg) = "" Then Response.Redirect repage & ".asp?id=" & Server.URLEncode(photoid) else %>
<%= pgtitle%>
Your Form was not submitted.
Please check & provide following details
<%=Trim(EMsg)%>
<% end if %>