Solved

Download a file from FTP with CFFTP  tag

Posted on 2001-08-21
11
394 Views
Last Modified: 2013-12-24
I'm trying to download files from a ftp server using CFFTP tag from my website.
The code is:

<cfftp action="GETFILE" server="xxxx" username="xxxx"
password="xxxxx" stoponerror="Yes" passive="Yes"
localfile="c:\test.nfo" remotefile="/test/test.nfo" transfermode="AUTO" failifexists="No" asciiextensionlist="nfo;sfv;" passivemode="yes">

<CFOUTPUT>
FTP directory listing of #cfftp.returnvalue#.
</CFOUTPUT>

but not works cause anything is downloaded. The result is:
FTP directory listing of 226 Transfer complete..

but anything downloaded

What are am I doing wrong?
Help

0
Comment
Question by:Xavi053000
11 Comments
 
LVL 37

Expert Comment

by:meverest
Comment Utility
this is similar to doing this:
========================================
C:> cd c:\temp
C:\temp> ftp xxx
User (xxx): xxx
password: xxx
ftp:> cd /test
ftp:> get test.nfo
ftp:> bye
========================================

so you would expect that the file 'test.nfo' will be copied to your local directory c:\temp\test.nfo

now you can use ccfile to open that file and process it however you want, like:

<cffile action="READ" file="c:\temp\test.nfo" variable="var">

<cfoutput>
contents of file: #var#
</cfoutput>

0
 

Author Comment

by:Xavi053000
Comment Utility
Ok, for text files this work but if i would like that the user download a mp3, exe, jpg file from the ftp through the navigator? readbinary don't works. :(
0
 
LVL 37

Expert Comment

by:meverest
Comment Utility
if you want to display the downloaded images in the browser, just do a cfftp to save the file into a web folder (eg: localfile="c:\inetpub\wwwroot\test.gif") then just display it like usual: <img src="test.gif">

you could use cfcontent, but the above is the easiest way.

cheers.
0
 

Author Comment

by:Xavi053000
Comment Utility
No, i want that the user download the file as when he download a file with <a href="test.exe">, but the ftp with cfftp. D u understand me?
0
 
LVL 37

Expert Comment

by:meverest
Comment Utility
well, cfftp is for downloading files from an ftp server to the coldfusion server, so you can't use it to transfer files to the end user.

if you want to send a file to the end user, you need to use some other method, like cfcontent maybe.

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Xavi053000
Comment Utility
well, thx for the help, but i don't know how make it with cfcontent, don't works fine
0
 
LVL 37

Expert Comment

by:meverest
Comment Utility
hi,

try this:

<CFHEADER NAME="Content-Disposition" VALUE="filename=filename.ext">
<cfcontent type="application/octet-stream" file="driveletter:\path\filename.ext">

change the relevent values to suit, but that will cause the 'save as' box to pop up on the user's browser to start the download.

cheers.
0
 

Author Comment

by:Xavi053000
Comment Utility
0
 

Author Comment

by:Xavi053000
Comment Utility
Sorry, my last message is wrong. The result of thjis cfcontent is the anssi characters of the mp3 file to download. I want that the navigator let me download the file where i want as u make Save As...
0
 
LVL 35

Expert Comment

by:mrichmon
Comment Utility
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation in the Cleanup topic area:

Accept meverest

Please leave any comments here within the next four days.

mrichmon
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
Comment Utility
PAQed, with points refunded (50)

GhostMod
Community Support Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now