WebDevelopment, ColdFusion, Railo, JS, Database and Tech-related by the Co-Founder and CEO of tunesBag.com

Monday, 24 September 2007

Upload files to Webserver using WebDAV

WebDAV is a cool alternative to FTP and due to it's HTTP-basis, the typical port / passive problems of FTP can be ignored. Since version 7, ColdFusion support a huge range of the WebDAV commands, including TRACE, OPTIONS and so on.
To put a file to an enabled server, you simply have to use the following code:

cfhttp method="PUT" url="http://Server/Directory/Filename" username="username" password="password" throwonerror="true" cfhttpparam type="header" name="Content-Type" value="content/type"
cfhttpparam type="file" name="file" file="#a_str_full_path_of_filename#"
Don't forget to check the cfhttp response for possible errors!

1 comment:

HTTP said...

f you like WebDAV, check out the BarracudaDrive home server with integrated WebDAV server.

A really easy to use and cool WebDAV client is Total Commander: http://www.ghisler.com/