Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

downloading files from SQL Server

Posted on 2009-04-04
5
Medium Priority
?
214 Views
Last Modified: 2013-12-24
Using Coldfusion 8 on windows platform with SQL Server 2008 Express.
I have a table that's holds files converted to binary.
When it came time to download I used this:

<cfheader name="content-disposition" value="attachment; filename=#getFile.name#">
<cfcontent variable="#getfile.Contents#">

... Which did everything I needed it to do, invoked a save as dialog box or open file.
Worked perfectly... in Firefox.

I've read this has issues in IE and yep! sure does.

So how can I get my file(s) back??

I shifted to this for the sake of IE knowing I could check the browser and IF it's IE do this:

<cffile action="write"
      file="C:\temp\#getFile.name#"
      output="#getFile.Contents#">

Which works perfectly... if you're saving to the server and not allowing the user to save to their drives, which is what I need.

To that I ask for help!

TIA
0
Comment
Question by:ecpeel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:duncancumming
ID: 24070546
Don't you need to use ToBase64() to convert it from Binary before doing cfcontent?
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 2000 total points
ID: 24077261
Normally hold the attachments externally, but in SQL 2008 can also hold as filstream - how have you stored them in 2008 ?

as an external file, this normally works :

<cfheader name="Content-Disposition" value="attachment; filename=#GetFile.FileName#">         or might try:   value="inline;
<cfcontent type='application/unknown' file='#RootDirectory#\#GetFile.FileName#'>                        the application/unknown normally invokes the save as...
0
 

Author Comment

by:ecpeel
ID: 24077486
@ Mark wills:
I converted to binary and stored them in a column of  image datatype. This seems to be working well and when tested  using Firefox and the CFcontent it converts back without using ToBase64() (responding to duncancumming).
OK got it to work: seems 'application/unknown' did the trick, but for the sake of discussion i'm including my code below.
Many thanks!

<cfheader name="content-disposition" value="attachment; filename=#getFile.name#"> 
<cfcontent variable="#getfile.Contents#"> 
<cfcontent type='application/unknown' file='#getfile.Contents#'>   

Open in new window

0
 

Author Closing Comment

by:ecpeel
ID: 31566703
Thank you for your quick response.
0
 
LVL 51

Expert Comment

by:Mark Wills
ID: 24077600
Happy to help...
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question