all groups > coldfusion flash integration > july 2007 >
You're in the

coldfusion flash integration

group:

using getURL with cfcontent and Excel files


using getURL with cfcontent and Excel files saintsilver
7/3/2007 9:25:04 PM
coldfusion flash integration:
I'm not sure if this should be a form question, a cfcontent question or a flash
question, so I apologize if this is not the proper place to post.

Here is the situation:

I have a flash form with a cfselect with
onchange=getURL('viewFile.cfm?requestedFile=someFileLocation','_blank')

the viewFile.cfm page is:
<cfif Right(requestedFile,3) IS "xls" OR Right(requestedFile,3) IS "XLS">
<cfheader name="Content-Disposition" value="inline; filename=Report.xls">
<cfcontent type="application/vnd.ms-excel"
file="\\myServer\myFolder\#requestedFile#">
</cfif>

#requestedFile# is encrypted and decrypted before and after passing the value,
but I left that out for simplicity.

The result is:
Action Canceled
Internet Explorer was unable to link to the Web page you requested. The page
might be temporarily unavailable.

If I hit F5 or click reload, the XLS document will open (after Open, Save or
Cancel Dialog Box).

Any other file type seems to work fine, it is only .xls that is giving me
trouble.

If I create the same form as an HTML form using onchange=window.open etc.
the document opens as requested (again, after dialog box)

However, I need to use the Flash Form.

Has anyone experienced this before?

Thanks.

Re: using getURL with cfcontent and Excel files BKBK
7/7/2007 6:48:41 PM
Two quick points. "XLS" is same as "xls" in Coldfusion, so no need to compare
for both. Use absolute path for the file attribute in cfcontent. Something like
this should work

<cfselect
size = "15"
required = "Yes"
query = "getData"
onchange="getURL('somePage.cfm?requestedFile=viewFile.xls','_blank')"
value ="id"
display ="name"
<option value = "">Select All</option>
</cfselect>


somePage.cfm
===============
<cfif Right(url.requestedFile,3) IS "xls">
<cfheader name="Content-Disposition" value="inline; filename=Report.xls">
<cfcontent type="application/vnd.ms-excel"
file="c:/coldfusion8/wwwroot/testfile.xls">
</cfif>




Re: using getURL with cfcontent and Excel files saintsilver
7/20/2007 7:42:52 PM
BKBK,

Thanks again for your help. I think what you are suggesting is essentialy the
same as what I have after it is processed. The only exception is that my excel
file is being loaded from a network share rather than from a folder on the C:
drive.

What I can't seem to understand is why the similar html version of the form
works fine, or why the flash form works when requesting a pdf document (<cfif
Right(url.requestedFile,3) IS "pdf"> etc.).

I'll take what you posted and play around a bit an see if I can make it work,
but please let me know if you know of anything else.

Thanks
AddThis Social Bookmark Button