So, I have a page where folks are submitting shipment info and getting a
label back to the browser in pdf format using cfcontent, cfheader in a
separate page called getLabels.cfm.  All the shipment processing is Ajaxy
and wonderful, and at the end a bit of javascript says...
window.location.replace("/pathTo/getShippingLabel.cfm?invoice="+o.invoice);

Simple and easy, normal stuff, been there, done that a million times..

<cfheader name="Content-Disposition" value="attachment;
filename=labels-#url.invoice#.pdf">
<cfcontent type="application/unknown"
file="#application.props.getproperty("labelsPath","")##url.invoice#.pdf">

So, here is the brain teaser. (and yeah, I left all the other code out)

When the label pdf doesn't exist, how to I stop the original calling page
from going to getLabels.cfm and displaying "File not found" message?  I
want the user to stay on the page they are working in.

Instead I would like to do this in getLabels.cfm

<cfif not
fileexists("#application.props.getproperty("labelsPath","")##url.invoice#.pdf")>
Do something magic and abort the request so the page doesn't change
<cfelse>
<cfheader name="Content-Disposition" value="attachment;
filename=labels-#url.invoice#.pdf">
<cfcontent type="application/unknown"
file="#application.props.getproperty("labelsPath","")##url.invoice#.pdf">
</cfif>

in 20 years of CF, I have never tried this...

M

-- 
-- 
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to houcfug-unsubscr...@googlegroups.com
For more options, visit http://groups.google.com/group/houcfug?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Houston ColdFusion Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to houcfug+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/houcfug/CAKb7GJME%3DrtnZ5ebYPGWi62Aye9XSF1a1dCzfMdd%2BewtRw3vXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to