So for mergeList I would include all files that i want merged (those
required and optional) and  thisFile I would include the the optional files?
I also have two sets of optional files cv 1 through 6 and appendix 1 through
6. Can I use thisFile for both?

On Tue, Jan 11, 2011 at 10:39 PM, Justin Scott <[email protected]>wrote:

>
> You'd probably want to build your merge list dynamically:
>
> <cfset mergeList = "" />
> <cfloop from="1" to="6" index="i">
>  <cfset thisFile = "D:\uploads\FAD\#evaluate('cv' & i)#" />
>  <cfif fileExists(thisFile)>
>    <cfset listAppend(mergeList, thisFile) />
>  </cfif>
> </cfloop>
>
> Then use #mergeList# as the "source" attribute for cfpdf since it
> should only include files that were uploaded and exist on the server.
> I'd avoid using evaluate() if possible though, I included it here for
> your existing variable names but you could do better using a structure
> to store the filenames instead.
>
> --
> Justin Scott
>
>
> On Tue, Jan 11, 2011 at 4:36 PM, Michelle  Dupray <[email protected]>
> wrote:
> >
> > I have a form where people submitted pdf documents. I want to give them
> the option to merge pdf documents if possible. Not all the documents people
> submitted were required, some were optional. I'm noticing that when somebody
> did not submit an optional document the Merge Pdfs link doesn't appear and I
> presume it is because the system can't find the optional document. Is there
> anyway around this? In the code below #cv2# through #cv6#. Thanks in advance
> for your help!
> >
> > <cftry>
> >        <cfpdf action="merge" source="D:\uploads\FAD\#cv1#,
> D:\uploads\FAD\#cv2#, D:\uploads\FAD\#cv3#, D:\defaultweb\uploads\FAD\#cv4#,
> D:\defaultweb\uploads\FAD\#cv5#, D:\defaultweb\uploads\FAD\#project_desc#,
> D:\defaultweb\uploads\FAD\#abstract_file#,
> D:\defaultweb\uploads\FAD\#budget_file#,
> D:\defaultweb\uploads\FAD\#bibliography#,
> D:\defaultweb\uploads\FAD\#appendices#"
> destination="D:\defaultweb\uploads\FAD\twoChaps.pdf" overwrite="yes">
> >        <a href="http://www.example.org/uploads/FAD/twoChaps.pdf";
> target="_blank">Merged Pdf</a><cfcatch></cfcatch></cftry>
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5195
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to