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

CFFile problem

Status
Not open for further replies.

yongde

MIS
May 6, 2001
2
SG
Everything works fine when i upload the file using the codes below, but it upload a 0 bytes file. Can anyone resolve this ?

<cfset filename=&quot;mp3.txt&quot;>
<cfset myfile=&quot;D:/new/mp3/mp3.txt&quot;>
<cfftp action=&quot;open&quot;
server=&quot;username=&quot;somename&quot;
password=&quot;somepassword&quot;
stoponerror=&quot;no&quot;
Connection=&quot;myconnection&quot;>
<cfif cfftp.Succeeded is &quot;Yes&quot;>
<cfoutput>Connection Established</cfoutput>
<cfelse>
<cfoutput>#cfftp.ErrorText#</cfoutput>
<cfoutput>#cfftp.ErrorCode#</cfoutput>
</cfif>
<cfoutput>
<cfftp connection=&quot;myconnection&quot;
action=&quot;PutFile&quot;
RemoteFile=&quot;mp3.txt&quot;
LocalFile=&quot;D:/new/mp3/mp3.txt&quot;>
<cfif cfftp.Succeeded is &quot;Yes&quot;>
Connection Established
<cfelse>
#cfftp.ErrorText#
#cfftp.ErrorCode#
</cfif>
</cfoutput>
 
hi yongde

Your CF code looks great, good error handling as well.

The problem might be that CF isn't prepared for what its about to process. Make sure that your form has the ENCTYPE attribute. This tells CF that there's not only form data, but multipart coming accross as well.

<form name=&quot;x&quot; action=&quot;action.cfm&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;>

let me know if this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top