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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFTP uploads filename but with NO data!?

Status
Not open for further replies.

mikovision

Programmer
Jun 13, 2001
4
US
I working with CFFTP and have it working. It will place a file name on the FTP server just fine. The only problem is that it is Zero length (byte size is zero). Am I missing a CFFTP variable? FORM.FILE1 is a file input.

<CFFTP CONNECTION=FTP
USERNAME=&quot;username&quot;
PASSWORD=&quot;password&quot;
SERVER=&quot;xxx.xxx.x.x&quot;
ACTION=&quot;open&quot;
STOPONERROR=&quot;no&quot;>

<CFFTP CONNECTION=FTP
ACTION=&quot;PutFile&quot;
LOCALFILE=&quot;#form.file1#&quot;
REMOTEFILE=&quot;RemFileName&quot;
TIMEOUT=&quot;600&quot;
STOPONERROR=&quot;No&quot;>

<CFFTP ACTION=&quot;close&quot;
CONNECTION=FTP
STOPONERROR=&quot;Yes&quot;>

- Mike
 
Try this:

<CFSET LocDir= GetDirectoryFromPath(#form.File1#)>
<CFSET LocFile= GetFileFromPath(#form.File1#)>

<CFFTP CONNECTION=FTP
USERNAME=&quot;username&quot;
PASSWORD=&quot;password&quot;
SERVER=&quot;xxx.xxx.x.x&quot;
ACTION=&quot;open&quot;
STOPONERROR=&quot;no&quot;>

<CFFTP CONNECTION=FTP
ACTION=&quot;PutFile&quot;
LOCALFILE=&quot;#LocDir#\#LocFile#&quot;
REMOTEFILE=&quot;RemFileName&quot;
TIMEOUT=&quot;600&quot;
STOPONERROR=&quot;No&quot;>

<CFFTP ACTION=&quot;close&quot;
CONNECTION=FTP
STOPONERROR=&quot;Yes&quot;>
John Hoarty
jhoarty@quickestore.com
 
Did this answer your question? If no, I believe I know what the problem is. - tleish
 
Can you post at least 2 lines of your txt file? - tleish
 
tleish,

If your question asking if it worked is aimed at me, well the answer is no. I am pulling my hair out tring to get this to work. Everywhere I search for a working sample of CFFTP comes up nil. Sure there are examples of dir and file listings with cfftp but no actual ftp file uploads. I am now wondering if it works at all.

-Mike
 

K, here's the deal. The CFHTTP tag works a little different then what you may think.

It appears that you are attempting to use a form to upload a file to a server using <CFFTP>. In order to do that you have to do the following process:

We have 3 &quot;actors&quot; involved in this process:
1. Browser
2. CF Server (server running ColdFusion)
3. FTP Server (Server where the file is being sent via FTP)

Step 1:
User submits file with form in Browser
(make sure your form include:
[COLOR=000080][COLOR=FF8000]<FORM ENCTYPE=&quot;multipart/form-data&quot;>[/color][/color])

Step 2:
Using <CFFILE> the CF Server recieves the file and moves it to a temp directory

Step 3:
Using <CFFTP> the CF Server sends the file to the FTP Server


<CFFTP> does not take a file from a form, the file must be somewhere on the machine running ColdFusion or on a local network that the CF Server has access to. <CFFTP LOCALFILE=&quot;c:\absolute\cf\server\path&quot;>. Only <CFFILE> can take a file from a form.

If all you want to do is upload a file to the local network, then you can skip step 3 all together, and just use step 2.

Does that make sense? - tleish
 
I forgot to add that if
<CFFTP LOCALFILE=&quot;c:\absolute\cf\server\path&quot;>
doesn't exist, then <CFFTP> will upload a blank Zero length (byte size is zero) file to the server. That's why you are having that problem. - tleish
 
tleish,

This sheds new light on the subject and not to mention...a sign of posible project completion. One question though, you mention CFHTTP at the top of your message but do not mention it anywhere in the subject. Is there a reason for this?

- Mikovision
 
Try to set the transfermode=... attribute in the cfftp tag to an appropriate mode.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top