[thelist] Possible with CF

Seth Bienek seth at sethbienek.com
Thu Aug 23 21:07:25 CDT 2001


Howdy --
> I have to upload a file from one server to another 
> via the http upload method.
<snip>
> cannot get it to work automatically.  Can anyone 
> offer any suggestions on how to accomplish this?

Ok, this is fun stuff.  You need a CF template on the sending server, which we'll call 'sender.cfm' and a CF template on the receiving server, which we'll call 'receiver.cfm'.

Sender will basically pack the form up (MIME encode it) and post it to receiver, which will unpack it and save it.  This is not tested code, and it isn't intended to work as is, but it should get you headed in the right direction.

<!--- Sender.cfm --->
<cfhttp method="post" url="http://foo.com/receiver.cfm">
  <cfhttpparam type="file" name="pr0n" file="c:\boobies.jpg">
</cfhttp>
<!--- END Sender.cfm --->

<!--- Receiver.cfm --->
<cffile action="upload"
	filefield="form.pr0n"
	destination="d:\inetpub\wwwroot\pr0n"
	nameconflict="overwrite">
If your image appears here, it was uploaded successfully:<br>
	<cfoutput>
		<img src="\pr0n\#file.ServerFile#"><br>
		filename: #file.ServerDirectory#\#file.ServerFile#
	</cfoutput>
<!--- END Receiver.cfm --->

Easier than you thought, eh?

Again, this is only theoretical, but it should work (or at least give you something to think about).

Best Regards,

Seth






More information about the thelist mailing list