Solved

Download a file from FTP with CFFTP  tag

Posted on 2001-08-21
11
411 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
[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
11 Comments
 
LVL 37

Expert Comment

by:meverest
ID: 6411834
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
ID: 6413501
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
ID: 6413583
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
MongoDB Through a MySQL Lens

This article looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.

 

Author Comment

by:Xavi053000
ID: 6415365
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
ID: 6415508
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
 

Author Comment

by:Xavi053000
ID: 6415889
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
ID: 6415910
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
ID: 6417551
0
 

Author Comment

by:Xavi053000
ID: 6417601
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
ID: 10837399
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
ID: 10864866
PAQed, with points refunded (50)

GhostMod
Community Support Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
What You Need to Know when Searching for a Webhost Provider
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

632 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