tags:

views:

265

answers:

1

I can't seem to open a powerpoint(ppt) doc using cfcontent. My code has no problem opeing other types of office docs. Below is the code:

<cfheader name="content-disposition" value="attachment; filename=#qry.clientFile#"/>
<cfcontent type="#qry.contentType#/#qry.contentSubType#" variable="#qry.documentData#"/>

qry.clientFile = Presentation2.ppt
qry.contentType = application
qry.contentSubType = vnd.ms-powerpoint
qry.documentData = the doc itself

I'm using the line aboves to open other doc no problem. Also, I'm trying to open a office 2003 ppt file in office 2007.

Any help would be great.

Don

+1  A: 

If you're just passing the name of the file as the variable argument that's incorrect. You need to provide a binary variable in the variable argument. If you just have the file on disk, then you need to use the file argument with a full drive path to the powerpoint file itself.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags%5Fc%5F11.html

<cfcontent type="#qry.contentType#/#qry.contentSubType#" file="#ExpandPath(qry.documentData)#">

Dan

Daniel Short
I'm passing the binary. Document documentData is the binary field stored in the database.
Don
I see, I missed that in the sample code... In that case, what *exactly* happens when you run your code. As Antony asked, "What error do you get?" Also, can you inspect the headers when you download a word doc versus a powerpoint file? There may be a difference there as well.
Daniel Short
It opens powerpoint and gives me the following error: PowerPoint can't open this file, because it is in use by another user. One other thing, I can save the file to a drive but when trying to open it, powerpoint can not open it because it says it is corrupt.I will look at the headers and get back to you soon. Thanks
Don
Are you sure that your file is valid in the database? Try loading one directly off of disk and see what happens...
Daniel Short
I will try that and let you know.
Don
Uploading and downloading to disk work fine for me.
Don
But I need to get it to work with the database.
Don
I'm using the same upload code to the database and to the disk.The upload looks the same:To Disk:cffile action="UPLOAD" filefield="FileName" destination="#myDestination#" nameconflict="MAKEUNIQUE" accept="application/pdf,image/jpeg,application/msword,application/vnd.ms-excel,image/jpg,image/pjpeg,image/gif,application/vnd.ms-powerpoint,image/tiff" attributes="Archive"To Database:cffile action="upload" filefield="#arguments.fileName#" destination="#arguments.fileDestination#" nameconflict="makeunique" accept="#arguments.fileTypesAllowed#"The file be should valid in the db.
Don
One more thing. I used firefox and I'm get this error when I click on the document name: powerpoint can't read the outline from filename. no text converter is installed for this file typeIt really looks like my ppt file is jacked up but I don't know were it is happening.
Don
What code are you using to save it to the database? And you've verified the file is good before the upload, correct?
Daniel Short
Daniel thanks for your help so far and sorry for the delay. I was working on another project. The file is good in the database. I wrote a .net app and it opens it ok. I still can't get it to open in coldfusion.Below is the code that I use to open the document. Note this code works fine for other type of documents.cfheader name="content-disposition" value="attachment; filename=#qry.clientFile#"cfcontent type="#qry.contentType#/#qry.contentSubType#" variable="#qry.documentData#"
Don
Try using a generic mime type and see if that makes a differnece, type="application/octet-stream"
Daniel Short
That did not work either. I even took of the type attribute off all together. Also, proceded to removed the cfheader statement. Same results, except it save it to disk. Then powerpoint could not open the file.
Don
In that case I'm at a total loss.... If you can download the powerpoint before it goes into the database, but not after, then I can only assume something is getting broken in process of saving the data to the DB. If you're successfully saving other binary objects to the DB, then I don't know where to tell you to look...
Daniel Short
Feel the same way. I'm going save all power point files to disk and any other file types to the database. It will not be hard but it is pain to do.Thanks for your help.
Don