Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFCONTENT

Status
Not open for further replies.

eportstudents

Programmer
Apr 11, 2001
4
US
Hi, I'm trying to view different files (both text and images) using CFCONTENT. I can view texts easily but cannot view the files. this is my code:
<CFCONTENT TYPE=&quot;application/unknown&quot;
FILE=&quot;#getdirectoryfrompath(&quot;c:\&quot;)#work_area\#url.file#&quot;
DELETEFILE=&quot;No&quot;>

if an image file comes up and i clikc on it...the browser begins to download the file to view it yet it is stuck on the same thing and the image never comes up.
what am i doing wrong?
 
Hi,

I've heard alot of discussion on this and many people have said that it is either impossible or requires a custom tag.

but I've also heard that this works

<CFSET f = &quot;x.jpg&quot;>
<CFHEADER NAME=&quot;content-disposition&quot; VALUE=&quot;attachment; filename=#f#&quot;>
<CFCONTENT TYPE=&quot;application/JPEG&quot; FILE=&quot;D:\ DELETEFILE=&quot;No&quot;>

If not go to and type &quot;glob&quot; in to the search. It should come up with some custom tags.

Hope it works for you.
 
Hi, I tried that solution and it didn't work...I dont understand why it doesnt work tho. Can someone please explain it to me?
We have this project to finish and this is the only glich we have. So any help is much appreciated.
 
Hey EP,

Try this:

<CFCONTENT TYPE=&quot;image/gif&quot; DELETEFILE=&quot;NO&quot; FILE=&quot;c:\temp\test.gif&quot;>

Make sure you put a valid gif file named test.gif in your c:\temp directory. If it doesn't work, I think you have a browser bug as that code comes straight from a working application. If this works though, change the &quot;image/gif&quot; to &quot;application/unknown&quot; and see if that makes a difference. If I suspect that the &quot;application/unknown&quot; may be causing the problem since you're not reporting the correct content type. If both of those do work, try this:

<cfif fileexists(&quot;#getdirectoryfrompath(&quot;c:\&quot;)#work_area\#url.file#&quot;)>
No problem
<cfelse>
Path to file is not correct:
<cfoutput>#getdirectoryfrompath(&quot;c:\&quot;)#work_area\#url.file#</cfoutput>
</cfif>

Let me know what happens.
GJ
 
GunJack, thanks for that advice. It appears to be a browser problem. we got it to work in Netscape but we are having difficulties with IE. It worked in IE a few times but it doesnt work again. Do you how IE handles mime types and how we can configure the browser?

Thanks a lot
EP
 
Hey Ep,

I'm not sure about configuring the browser. Most of my work is on the coding side and mime types are one of those things I deal with very infrequently. Have you tried upgrading or worst case re-installing? I hate to recommend this over &quot;fixing&quot; the problem but I can't be of much help with IE as I don't use it.

Good luck,
GJ
 
hey GJ,
the weirdest thing...it works! i dont kno how and i dont kno why but i can view the files in both netscape and IE
thanx a lot for ur help

much appreciated,

EP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top