home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Examples / publish / admin / addcontent3b.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  1.7 KB  |  64 lines

  1. <CFSET RootPath = Reverse(Replace(Reverse(GetTemplatePath()),Reverse("admin\#GetFileFromPath(GetTemplatePath())#"),""))>
  2.  
  3. <!---<CFIF FileExists(#RootPath#binarydata\--->
  4.  
  5. <CFFILE ACTION="UPLOAD"
  6.         FILEFIELD="UploadedFile"
  7.         DESTINATION="#RootPath#binarydata"
  8.         NAMECONFLICT="SKIP"
  9.         ACCEPT="image/*, application/msword, application/pdf">
  10.  
  11. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  12.  
  13. <HTML>
  14. <HEAD>
  15.     <TITLE>Upload File</TITLE>
  16. </HEAD>
  17.  
  18. <BODY BGCOLOR="#660000" TEXT="#FFFFFF" LINK="#FFFF00" VLINK="#FFFF00">
  19.  
  20. <P><IMG SRC="images/addcontent.gif" WIDTH=109 HEIGHT=20 BORDER=0 ALT="Add Content"></P>
  21.  
  22. <CFIF File.FileExisted>
  23.  
  24.     <CFOUTPUT>
  25.         <SCRIPT LANGUAGE="JAVASCRIPT">
  26.            alert('The file "#File.ClientFile#"\nalready exists on the server.\n\nPlease rename your file and try again.');
  27.            location.replace('#CGI.HTTP_REFERER#');
  28.         </SCRIPT>
  29.         The file #File.AttemptedServerFile# already exists on the server.<BR>
  30.         Please rename your file and try again.
  31.     </CFOUTPUT>
  32.  
  33. <CFELSE>
  34.  
  35.     <CFTRANSACTION>
  36.  
  37.         <CFQUERY DATASOURCE="CFexamples" NAME="GetTopContentID">
  38.         SELECT Max(ContentID) AS MaxID FROM PubContent
  39.         </CFQUERY>
  40.     
  41.         <CFIF GetTopContentID.MaxID IS "">
  42.             <CFSET NewContentID = 1>
  43.         <CFELSE>
  44.             <CFSET NewContentID = GetTopContentID.MaxID + 1>
  45.         </CFIF>
  46.     
  47.         <CFQUERY DATASOURCE="CFexamples" NAME="InsertContent">
  48.         INSERT INTO PubContent (ObjectID, TypeID, Data)
  49.         VALUES (#ObjectID#, #TypeID#, '#File.ServerFile#')
  50.         </CFQUERY>
  51.  
  52.     </CFTRANSACTION>
  53.  
  54.     <CFQUERY DATASOURCE="CFexamples" NAME="UpdateTime">
  55.     UPDATE PubObjects SET DateUpdated = #Now()#
  56.     WHERE ObjectID = #ObjectID#
  57.     </CFQUERY>
  58.  
  59.     <CFLOCATION URL="properties.cfm?ObjectID=#ObjectID#">
  60.  
  61. </CFIF>
  62.  
  63. </BODY>
  64. </HTML>