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 Chriss Miller 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.

Silvano

Programmer
Jul 16, 2001
386
US
hi all,
here is the code I am using to send the selected file to the user:

<cfheader name=&quot;Content-Disposition&quot; value=&quot;inline; filename=#form.fileID#&quot;>
<cfcontent type=&quot;application/unknown&quot; file=&quot;#ExpandPath('userData\#request.sqClientInfo.Users_ID#\#form.fileID#')#&quot; deletefile=&quot;No&quot;>

problem I have is this: by the definition, if MIME type of the cfcontent tag is set to application/unknown, the Web browser is guaranteed to attempt to save the file to the disk (that is exactly what I want) rather then open the application the Web browser believes is appropriate; however, when executed if pdf file is sent, the browser will open it in the Adobe reader; same for gif or jpg files, those are open in a default image editor;

does someone know how to send a file using the cfcontent tag and force the browser to open the Save dialog box instead of open the file? Sylvano
dsylvano@hotmail.com
 
I don't think you can do this if the browser has a MIME association for a specific file extension. I tested this on an app I wrote just now; it let me save a .txt file, but it opened the PDF without asking.

-Tek
 
In most of the cases, using those two lines will make it:
<CFHeader NAME=&quot;Content-Disposition&quot; VALUE=&quot;attachment; filename=#FileName#;&quot;>
<CFHeader NAME=&quot;Content-Length&quot; VALUE=#len(outputContent)#>

Except for some bogus IE versions, this wil always ask to save OR open the file
 
In most of the cases, using those two lines will make it:
Code:
<CFHeader NAME=&quot;Content-Disposition&quot; VALUE=&quot;attachment; filename=#FileName#;&quot;>
<CFHeader NAME=&quot;Content-Length&quot; VALUE=#len(outputContent)#>

Except for some bogus IE versions, this wil always ask to save OR open the file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top