Solved

How to upload multiple files at once using CFFILE

Posted on 2010-08-15
5
845 Views
Last Modified: 2012-05-10
ColdFusion 8
MS SQL Server 2005

I have an application that creates or edits a database record, and associates a file (DOC, XLS, etc) gdemaria, azadi, and _agx_ helped me with this application last April - May. Since then I have refined the application, listening to the client's requests. It's working well and the client is ... 88% happy. I have come to a point at which I need to ask advice about uploading multiple files in one Submit action.

The application currently uploads one file at a time. Client wants to upload, say, four or six or eight documents at a time.

Of course it is not so simple as replicating the cfinput type="file" input fields. Each file is assigned its own:

                        FileID,
                  FileName,
                  FileLinkText,
                        FileExtension,
                        FileType,
                        FileSize,
                  isDeleted
               
and is associated with a particular DocumentID.

So: can I create a loop that sets up a number (4 or 6 or 8?) of cfinput type="file" fields, and each input field uploads a separate document? No, a loop, is not the answer -- there is nothing to loop through. I need to create a series of input fields:

<!--- input field 1: contains fields to browse for a file, and enter FileLinkText--->
				<tr><td>  
<cfinput type="file" size="25" accept="application/msexcel,application/msword,application/pdf,image/gif,image/jpeg,image/x-png" name="FileName" class="btn" onmouseover="this.className='btn btnhov'" onmouseout="this.className='btn'" maxlength="255" />
				</td>
	
    		<td>
   <p><strong>Enter File Link Text:</strong> <a href="#" class="hintanchor" onMouseover="showhint('What link text should the user click on to open this file?', this, event, '200px')">[?]</a><br />

   <cfinput type="Text"
            name="FileLinkText"
            value=""
            size="50"
            maxlength="100" /></p>
             </td></tr>


<!--- input field 2: contains fields to browse for a file, and enter FileLinkText--->
				<tr><td>  
<cfinput type="file" size="25" accept="application/msexcel,application/msword,application/pdf,image/gif,image/jpeg,image/x-png" name="FileName" class="btn" onmouseover="this.className='btn btnhov'" onmouseout="this.className='btn'" maxlength="255" />
				</td>
	
    		<td>
   <p><strong>Enter File Link Text:</strong> <a href="#" class="hintanchor" onMouseover="showhint('What link text should the user click on to open this file?', this, event, '200px')">[?]</a><br />

   <cfinput type="Text"
            name="FileLinkText"
            value=""
            size="50"
            maxlength="100" /></p>
             </td></tr>



etc....

Open in new window


... but each input field would need to create its own FileID, FileName, FileLinkText, etc. in table tbl_CEP_files, and associate with the correct documentID in table tbl_CEP_Documents.

What should my strategy be?

And, can I articulate this question so that my task is clearer?

Thank you as always.

Eric B
<!---

Name:        insert_update.cfm

Author:      Eric B, following Ben Forta code in ColdFusion 8 web application construction kit; gdemaria; azadi; _agx_; Plucka; myselfrandhawa

Description: CEP add and update documents administration

Created:     2/24/2010 - 6/22/2010

ColdFusion Version 8

MS SQL Server 2005

--->







<!--- Page header --->

<cfinclude template="cep_header.cfm" />



 <!--- Set default value for FileID in scope FORM --->

<cfparam name="form.FileID" default="">



 <!--- Set default value for NumberFiles in scope FORM --->

<cfparam name="form.NumberFiles" default="">



 <!--- Set default value for SelectDocumentTopics in scope FORM --->

<cfparam name="form.SelectDocumentTopics" default="0" />







 <!--- Set default value for DocumentID in scope URL --->

<cfparam name="URL.DocumentID" default="">



 <!--- Define DocumentID in scope FORM, then set form.DocumentID equal to the DocumentID passed in the URL: for use later in the application --->

<cfparam name="form.DocumentID" default="#URL.DocumentID#">





 <!--- Set datasource --->

 <cfset ds="ebwebwork">

  

 <!---- begin CFTRY; catch any errors, whether you throw them or the database does; and to test that file were uploaded successfully, or not  ---->

 <cftry>  

 



<!---- populate this with an error message ---->

<cfset variables.error = ""> 





        <!--- BEGIN: Save action --->





<!--- begin form.doSave --->



<!--- when the user clicks the Save Button, these events can occur: Add a document; Update a document; Delete a Document; Delete a file that is associated with a document --->



<cfif IsDefined("FORM.doSave")>





<!--- make sure that documentTitle and documentType are entered --->  

    

	<cfif len(form.DocumentTitle) eq 0>

			  <cfthrow message="Document Title is required">

	</cfif>

    

    <cfif len(form.DocumentType) eq 0>

			  <cfthrow message="Document Type is required">

	</cfif>





 <!--- in this query select NOTHING from table tbl_CEP_documents, and simply check if DocumentTitle exists --->

 

 <cfquery datasource="#ds#" name="CheckDocumentTitle">

  SELECT 'Nothing' FROM tbl_CEP_Documents

  WHERE DocumentTitle = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#Form.DocumentTitle#">

  AND DocumentID <> <CFQUERYPARAM CFSQLTYPE="cf_sql_integer" VALUE="#val(Form.DocumentID)#">

  </cfquery>

   

 

  

   <!--- if DocumentTitle exists, display error; refuse record insert --->

   

	<cfif CheckDocumentTitle.recordcount GT 0>

		   <cfthrow message="The Document Title is already taken; please enter another title">

	</cfif>

    

    <!--- begin statements to update, insert database records --->  

   

    <!--- begin cfif val(form.DocumentID) --->

    

    <!--- the action is UPDATE; a DocumentID Exists --->

    

				<cfif val(form.DocumentID)>

                

         

                

<!--- group three queries in a cftransaction: UPDATE Document; DELETE Document Topics; INSERT (new) Document Topics--->

<cftransaction>

    

  			  <cfquery name="UpdateDocument" datasource="#ds#">

				  UPDATE tbl_CEP_Documents

				  SET   DocumentTitle = <cfqueryparam cfsqltype="cf_sql_varchar"  value="#Trim(form.DocumentTitle)#">,

					DocumentType = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentType)#">,

					DocumentAuthor = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentAuthor)#">,

				    DocumentAbstract = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentAbstract)#">,

				    DocumentPublicationDate = <cfqueryparam cfsqltype="cf_sql_date" value="#Trim(form.DocumentPublicationDate)#">,

				    DateRecordModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">

				  WHERE DocumentID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.DocumentID)#">

			</cfquery>





<cfquery name="UpdateDocumentDeleteTopics" datasource="#ds#">

   DELETE FROM tbl_Document_Has_Topic

   WHERE DocumentID = <cfqueryparam value="#form.DocumentID#" cfsqltype="cf_sql_integer">

</cfquery>



<cfquery name="UpdateDocumentInsertNewTopics" datasource="#ds#">

INSERT INTO tbl_Document_Has_Topic

		(

        DocumentID

        ,  DocumentTopicID

        )

SELECT   <cfqueryparam value="#form.DocumentID#" cfsqltype="cf_sql_integer">

         , DocumentTopicID

FROM     tbl_CEP_Document_Topic

WHERE   DocumentTopicID  IN

(

<cfqueryparam value="#form.SelectDocumentTopics#" cfsqltype="cf_sql_integer" list="true">

)

</cfquery>

</cftransaction>







    <!--- CFELSE: DocumentID does not exist, then insert new document --->

				<cfelse> 

                

                

      <!--- use two queries: one to insert the record into tbl_CEP_Documents; one to insert DocumentID and DocumentTopicID into tbl_Document_Has_Topic  --->

      <!--- use cftransaction so both queries are processed together  --->

    

    

        <cftransaction>

	

				<!---- query to insert new document record into tbl_CEP_Documents ---->

					<cfquery name="InsertDocument" datasource="#ds#" result="newDocument">

				 INSERT INTO tbl_CEP_Documents

     					(

			            DocumentTitle,

            		    DocumentType,

                		DocumentAuthor,

		                DocumentAbstract,

        		        DocumentPublicationDate,

                		SSMA_TimeStamp

		                )

			     VALUES(

						  <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentTitle)#">,

						  <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentType)#">,

						  <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentAuthor)#">,

						  <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.DocumentAbstract)#">,

						  <cfqueryparam cfsqltype="cf_sql_date" value="#Trim(form.DocumentPublicationDate)#">,

		     			  <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">

				         )         

					</cfquery>

                  

    <!--- cfquery to get the selected document topics, and insert them into tbl_Document_Has_Topic along with the document ID --->

            <cfquery name="InsertDocumentTopics" datasource="#ds#">

                 INSERT INTO tbl_Document_Has_Topic

                 		(

                        DocumentID,

                        DocumentTopicID

                        )

                  SELECT

                   <cfqueryparam value="#newDocument.IDENTITYCOL#" cfsqltype="cf_sql_integer">

                   , DocumentTopicID

                   FROM  tbl_CEP_Document_Topic

                   WHERE   DocumentTopicID  IN

                  (

                     <cfqueryparam value="#form.SelectDocumentTopics#" cfsqltype="cf_sql_integer" list="true">

                  )

               </cfquery>

        </cftransaction>     

             

                  

                    

	 <!--- use the result attribute value to set the form field value --->

      <cfset form.DocumentID = newDocument.IDENTITYCOL>



		<!--- END queries to update or insert database records ---> 



        <!--- END cfif val(form.DocumentID) -- if a document needed to be updated, or added, then it was done --->

					    </cfif>  

    

    

    

	   <!--- ============= BEGIN query to update column FileLinkText in tbl_CEP_Files ============= --->   

              <!--- this section must be placed within the Save Action --->  

 

        <cfloop index="kk" from="1" to="#val(form.numberFiles)#"> 

            <cfset form.updateFileLinkText = form['updateFileLinkText' & kk]>

            <cfset form.fileID = form['fileID' & kk]>

        

             <cfquery name="query_updateFileLinkText" datasource="#ds#">

                UPDATE tbl_CEP_Files

                SET FileLinkText = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.updateFileLinkText)#">

                WHERE FileID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.fileID)#">

             </cfquery>            

         

        </cfloop>

     

        <!--- ============= END query to update column FileLinkText in tbl_CEP_Files ============= --->   

    

    

    

<!--- remember cfif IsDefined("FORM.doSave") is still defined -- remember to close the cfif later --->

    

  

				<!--- test to see whether or not a file is being uploaded -- does form field FileName contain a file? --->         

  

		    	<!--- BEGIN: if form field FileName contains a file, then upload the file and the file's metadata --- this function updates the tbl_CEP_Files--->

      		<cfif form.fileName is not "">

     

            

			    <!--- BEGIN: upload a file using CFFILE --->       

     			<!--- cffile upload --->       

   			      <cffile action="upload" filefield="FileName" destination="c:\upload\cep-dc.org" nameconflict="overwrite">



			<cfif listFindNoCase("doc,docx,jpg,jpeg,png,gif,pdf,ppt,xls,xlsx,txt", cffile.serverFileExt) eq 0>

				    <cfthrow message="Your file did not upload. You may upload only permitted file types.">

			</cfif>

            



			<!---- query to insert new record into tbl_CEP_Files, with a file  (DOC, JPEG, PDF, etc.) to upload ---->

			<cfquery name="InsertFile" datasource="#ds#">

			 INSERT INTO tbl_CEP_Files

     			(

                DocumentID,

                FileName,

                FileLinkText,

				FileExtension,

				FileType,

				FileSize,

                isDeleted

                )

		     VALUES(

        		  <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.DocumentID)#">

				  ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#cffile.clientFile#">

                  ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(form.FileLinkText)#">

				  ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#cffile.clientFileExt#">

				  ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#cffile.contentType#">

				  ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#cffile.fileSize#">

                  ,0

		           )         

				</cfquery>  

  

		   <!--- END query to insert new record into tbl_CEP_Files --->  

 

 

    

  

  

           

              <!--- delete a file --->

      <!--- this section must be placed within the Save Action --->

 

    

    	   <!--- begin CFELSEIF isdefined(form.deleteFileID) --->

		 <cfelseif isDefined("form.deleteFileID")>        

   

    

	<!---- query to set a file to isDeleted = 1 ---->

    	   <cfquery name="DeleteFile" datasource="#ds#">

       			UPDATE tbl_CEP_Files

           		SET IsDeleted = 1

        		WHERE FileID in (<cfqueryparam cfsqltype="cf_sql_integer" value="#form.deleteFileID#" list="Yes">)

      		</cfquery>

            

            </cfif>

<!----- END form.fileName is not "" test to see if file is being uploaded ---->







	<!--- if insert record succeeded, and / or file upload succeeded, and / or FileLinkText were updated, then go to index page --->

				     <cflocation url="index.cfm" addtoken="no">



        

                    

    <!--- END: Save action --->

    



  

        <!--- BEGIN: Delete action --->





			   <!--- delete a database record --->

					   <!--- begin CFELSEIF isdefined(form.doDelete) --->

					        <cfelseif isDefined("form.doDelete")>        

					        <!---- query to delete record ---->

                            

                            <cftransaction>

					       	<cfquery name="DeleteDocument" datasource="#ds#">

					         DELETE FROM tbl_CEP_Documents

					         WHERE DocumentID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.DocumentID)#">

					        </cfquery>

                                                        

                            <cfquery name="UpdateDocumentDeleteTopics" datasource="#ds#">

							   DELETE FROM tbl_Document_Has_Topic

							   WHERE DocumentID = <cfqueryparam value="#form.DocumentID#" cfsqltype="cf_sql_integer">

							</cfquery>

                            </cftransaction>

              

 					        <!---- after delete, go to index page ---->

						 <cflocation url="index.cfm" addtoken="no">



	    <!--- END: Delete action --->

        

  



  <!--- END form.doSave --->

</cfif>











       <!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->

<cfcatch type="Any">

     <cfset variables.error = cfcatch.message>

     <cfrethrow>

  </cfcatch>



  

  

  

		  <!--- END CFTRY --->  

			</cftry>







<!--- fetch the data from the database only when there are no errors.

      if an error exists, then let the form variables pass back into the form to display ---->

 

  <cfif len(variables.error) eq 0>

    

			  <!--- get data from table tbl_CEP_Documents and convert the data into form variables --->

			  <cfquery name="getDocumentDetails" datasource="#ds#">

				    select * from tbl_CEP_Documents where DocumentID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.DocumentID)#">

			  </cfquery>



  			<cfloop index="aCol" list="#getDocumentDetails.columnList#">

			       <cfset "form.#aCol#" = getDocumentDetails[aCol][getDocumentDetails.currentRow]>

			  </cfloop>

    

	</cfif>





<!--- if there an error, display error in human readable form --->



<cfif len(variables.error)> 

			 <cfoutput>

			 <div style="border: 1px solid red; padding: 10px; margin:20px; width:400px;">#variables.error#</div>

			 </cfoutput>

</cfif>





				<!----- if record already exists (it will have an ID) then update it; otherwise, add new record... ----->

				<cfif val(form.documentID)>

					  <cfset FormTitle="Edit Document">

					  <cfset ButtonText="Update This Document">

  					  <cfset FileLinkTextButton="Update File Link Text">

				<cfelse>

						<cfset FormTitle="Add a Document">

						<cfset ButtonText="Add Document">



				</cfif>



  

				<!--- Add or Update Document Form begins here --->

				<cfform method="post" enctype="multipart/form-data" scriptsrc="#Request.CFFORM_JS_LIB#">





 <!--- Embed documentID (PK), fileID, numberFiles as hidden fields, to assign a value to each --->

 <cfoutput>

<input type="hidden" name="documentID" value="#form.documentID#" />



   </cfoutput>







  <cfoutput>



      <h2>#FormTitle#</h2>



  </cfoutput>

 

<table class="table_admin">

<cfif val(form.documentID)>

 <tr>

  <td>

<p><strong>Document ID: <cfoutput>#URL.DocumentID#</cfoutput></strong></p>

  </td>

 </tr>

 <cfelse>

 </cfif>



 <tr>

  <td>

   <p><strong>Document Title</strong><br />



   <cfinput type="Text"

            name="DocumentTitle"

            value="#form.DocumentTitle#"

            message="Document title is required! Please restrict the Document title to 100 characters or fewer."

            required="Yes"

            validateAt="onSubmit,onServer"

            size="100"

            maxlength="250" /></p>

  </td>

 </tr>

 <tr>

  <td>

   <p><strong>Document Type</strong>  <a href="#" class="hintanchor" onMouseover="showhint('Don\'t worry too much about document type. Specify document type \'Report\' for most CEP documents.', this, event, '200px')">[?]</a></p>



   <select name="DocumentType" value="#form.DocumentType#">

   			<option value="Report">Report</option>

            <option value="Policy Brief">Policy Brief</option>

            <option value="Press Release">Press Release</option>

            <option value="Article">Article</option>

            <option value="Summary">Summary</option>

            <option value="Letter">Letter</option>

            <option value="Audio Transcript">Audio Transcript</option>

            <option value="Text Transcript">Text Transcript</option>

   </select>

  </td>

 </tr>





 <tr>

  <td>

   <p><strong>Document Author</strong><br />



   <cfinput type="Text"

            name="DocumentAuthor"

            value="#form.DocumentAuthor#"

            message="Enter Document Author Name"

            required="yes"

            validateAt="onSubmit,onServer"

            size="100"

            maxlength="100" /></p>

  </td>

 </tr>

 

 

<!--- this query requests values from columns DocumentTopicID and DocumentTopic in tbl_CEP_Document_Topics --->

 <cfquery datasource="#ds#" name="GetDocumentTopics">

SELECT DocumentTopicID, DocumentTopic

FROM tbl_CEP_Document_Topic

ORDER BY DocumentTopic

  </cfquery>

 

  <tr>

  <td>

    <p><strong>Assign this Document to CEP Topics</strong> <a href="#" class="hintanchor" onMouseover="showhint('Assign this document to a topic', this, event, '200px')">[?]</a></p>

    

    

      <p class="small">Choose at least one topic. To select more than one topic, hold the Ctrl or the Shift key (on your keyboard) and select topics with the mouse cursor.</p>

   



<!--- query to get existing topics for the current documentID --->



       <cfquery datasource="#ds#" name="GetSelectedTopics">

              SELECT DocumentTopicID

              FROM    tbl_Document_Has_Topic

              WHERE  DocumentID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.documentID)#">

       </cfquery>

     

       <!--- convert the DocumentTopicID values to a list --->

      <cfset form.SelectDocumentTopics = ValueList(GetSelectedTopics.DocumentTopicID)>



<cfselect name="SelectDocumentTopics"

size="8"

multiple="yes"

query="GetDocumentTopics"

queryPosition="below"

value="DocumentTopicID"

display="DocumentTopic"

selected="#form.SelectDocumentTopics#">

     <option value="0">Choose topic:</option>

</cfselect>

 

  </td>

 </tr>

 



 <tr>

  <td>

   <p><strong>Document Abstract</strong><br />

   <cfoutput>

   <textarea name="DocumentAbstract" wrap="virtual" style ="width:600px; height:250px;">#form.DocumentAbstract#</textarea>

   </cfoutput></p>

  </td>

 </tr>

 

 

 <tr>

  <td>

   <p><strong>Publication Date (use form MM/DD/YYYY; please click the calendar icon, below)</strong><br />

   <cfinput name="DocumentPublicationDate"

            value="#DateFormat(DocumentPublicationDate, "mm/dd/yyyy")#"

            message="Publication Date must be a valid date!"

            required="no"

            validate="usdate"

            validateAt="onSubmit,onServer"

            size="10"

            maxlength="10"

            type="datefield" mask="MM/DD/YYYY" /></p>

  </td>

 </tr>





<tr>

  <td>

  







   <!--- display the files currently associated with the document --->



<cfif val(form.documentID)>

<p>Below, please see the files currently associated with Document ID <strong><cfoutput>#URL.DocumentID#</cfoutput></strong>. If there are no files associated with the document, then no files will appear below. You have the option to upload a file (PDF, DOC, image file), which will associate the file with this document.</p>

<cfelse>

<p>This is a new document. You have the option to upload a file (PDF, DOC, image file), which will associate the file with this document.</p>

</cfif>





   <!--- query to get columns and values from tbl_CEP_files, for use below --->

<cfquery name="getFiles" datasource="#ds#">

    SELECT *

    FROM tbl_CEP_files

    WHERE DocumentID=<cfqueryparam value="#val(form.DocumentID)#" cfsqltype="cf_sql_integer"> 

    AND isDeleted = 0

  </cfquery>

  



  <cfif getFiles.recordCount>

   <table class="tablecontrolpanel width600px">

     <tr>

      <td><strong>File ID</strong></td>

      <td><strong>Files associated with this CEP document:</strong></td>

      <td><strong>File Link Text</strong> <a href="#" class="hintanchor" onMouseover="showhint('What link text should the user click on to open this file?', this, event, '200px')">[?]</a></td>

      <td><strong>Mark for Deletion</strong>  <a href="#" class="hintanchor" onMouseover="showhint('If you want this file to no longer associate with this document, you can mark the file for deletion; the file will be deleted from the server', this, event, '200px')">[?]</a></td>

     </tr>

     

     

    <!--- loop through files called by query getFiles ---> 

     <cfloop query="getFiles">

     

     

	  

	 <cfoutput>

     <input type="hidden" name="numberFiles" value="#getFiles.recordCount#">

          

     <cfif CurrentRow MOD 2 IS 1>

        <cfset bgcolor="##ffffff">

        <cfelse>

        <cfset bgcolor="##ebebeb">

      </cfif>

      

     <tr style="background-color:#bgcolor#">



        <!---  get list of file IDs --->  

       <td>#getFiles.FileID#</td>







        <!---  get list of file names --->  

       <td>#getFiles.FileName#</td>

       



        <!--- input field to update file link text --->   

        

        <cfset CTR = getFiles.currentRow>

          

       <td><cfinput type="Text"

            name="updateFileLinkText#CTR#"

            value="#getFiles.FileLinkText#"

            size="50"

            maxlength="100" />

            <input type="hidden" name="fileID#CTR#" value="#getFiles.fileID#" />

       </td>

               

      

         <!--- Mark For Deletion checkbox --->      

       <td><input type="Checkbox" name="deleteFileID" value="#getFiles.fileID#"></td>



     </tr></cfoutput>



<!--- close loop through files called by query getFiles ---> 

     </cfloop>

     

   </table>



  <cfelse>

   <p><strong>At the moment, no files are attached to this document.</strong></p>

  </cfif>



<p><strong>Upload a <em>new</em> file: PDF, TEXT, DOC, DOCX, XLS, XLXS, or image files only:</strong> <a href="#" class="hintanchor" onMouseover="showhint('Browse your local computer disk to find a file to upload', this, event, '200px')">[?]</a></p>



  <!--- input field for file upload --->

  

<table class="tablecontrolpanel width600px">

				<tr><td>  

<cfinput type="file" size="25" accept="application/msexcel,application/msword,application/pdf,image/gif,image/jpeg,image/x-png" name="FileName" class="btn" onmouseover="this.className='btn btnhov'" onmouseout="this.className='btn'" maxlength="255" />

				</td>

	

    		<td>

   <p><strong>Enter File Link Text:</strong> <a href="#" class="hintanchor" onMouseover="showhint('What link text should the user click on to open this file?', this, event, '200px')">[?]</a><br />



   <cfinput type="Text"

            name="FileLinkText"

            value=""

            size="50"

            maxlength="100" /></p>

             </td></tr>

            </table>

            

            

           

   <div class="align-center">

   <!--- submit form to ColdFusion for processing; this is the DoSave function, which will add or edit a record --->

  <cfoutput>

    <input name="doSave" type="submit" value="#ButtonText#" class="btn" onMouseOver="this.className='btn btnhov'" onMouseOut="this.className='btn'" /> 

  </cfoutput>

  

  <span class="hintanchortext"><a href="#" class="hintanchor" onMouseover="showhint('Click the Update This Document button immediately left to apply your edits to this document', this, event, '200px')">[?]</a></span>

  

   </div>

<cfif val(form.documentID)>



<hr />



<div class="graybox align-center width250px">

  <p>The button, below, deletes this document, its database record, and its associated files. Use deliberately and with caution.</p>

</div>





<!--- submit form to ColdFusion for processing; this is the DoDelete function, which deletes a Document record --->

<cfoutput>

  <div class="align-center">

  <input name="doDelete" type="submit" value="Delete This Document" class="btn" onMouseOver="this.className='btn btnhov'" onMouseOut="this.className='btn'"  onclick="return confirm('Are you sure you wish to delete this document? After you delete it it is gone forever.')" />

  </div>

</cfoutput>



<cfelse>



</cfif>



</cfform>





<!--- Page footer --->

<cfinclude template="cep_footer.cfm" />

Open in new window

0
Comment
Question by:Eric Bourland
  • 3
  • 2
5 Comments
 
LVL 24

Accepted Solution

by:
dgrafx earned 500 total points
Comment Utility
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
dgrafx, thank you! I am looking into this.

I think having multiple file upload capability is going to dramatically change the scope of my application. I am rethinking this.

I'll report back tomorrow with something. =)

Have a good evening.

Eric B
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
dgrafx,

I am going to close this question for now. The client has decided this function is not a priority. And I do not want to spend a lot of development time editing this application. However, the link above to which you guided me is very useful. Thank you. I will keep it in mind.

Thanks very much for your help.

Eric
0
 
LVL 3

Author Closing Comment

by:Eric Bourland
Comment Utility
Thank you dgrafx.
0
 
LVL 24

Expert Comment

by:dgrafx
Comment Utility
thanks and good luck ...
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now