Solved

Download a file from FTP with CFFTP  tag

Posted on 2001-08-21
11
395 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
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
 

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
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Redirect website ! 4 53
JKS to store upstart data 2 85
Webserver access problem 5 68
Stream live video from Raspberry Pi camera 22 117
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

26 Experts available now in Live!

Get 1:1 Help Now