Flickr HTML form upload

Below is a Flickr upload script i've been playing around with. You'll notice that im using <CFHTTP> to post the data. This is so that you can insert the fields into another form, otherwise if you want you can post the form fields direct to more information on the Flickr Upload Api click here.
<cfset flickrEmail = "" />
<cfset flickrPassword = "" />

<cfif NOT isDefined("")>
   <form action="flickr.cfm" method="post" enctype="multipart/form-data">
      <table border="1">
         <tr><td>photo:</td><td><input type="file" name="photo"></td></tr>
         <tr><td>title:</td><td><input type="text" name="title"> (optional)</td></tr>
         <tr><td>description:</td><td><input type="text" name="description"> (optional)</td></tr>
         <tr><td>tags:</td><td><input type="text" name="tags"> (optional)</td></tr>
         <tr><td>is_public:</td><td><input type="text" name="is_public"> (optional 1 or 0)</td></tr>
         <tr><td>is_friend:</td><td><input type="text" name="is_friend"> (optional 1 or 0)</td></tr>
         <tr><td>is_family:</td><td><input type="text" name="is_family"> (optional 1 or 0)</td></tr>
         <tr><td>&nbsp;</td><td><input type="checkbox" name="async" value="1"> Async Mode</td></tr>
         <tr><td>&nbsp;</td><td><input type="submit" value="post it"></td></tr>
      <cfhttp url="" method="post">
         <cfhttpparam name="email" value="#flickrEmail#" type="formfield" />
         <cfhttpparam name="password" value="#flickrPassword" type="formfield" />
         <cfhttpparam name="photo" file="" type="file" />
         <cfhttpparam name="title" value="#form.title#" type="formfield" />
         <cfhttpparam name="description" value="description" type="formfield" />
         <cfhttpparam name="tags" value="#form.tags#" type="formfield" />
         <cfhttpparam name="is_public" value="#form.is_public#" type="formfield" />
         <cfhttpparam name="is_friend" value="#form.is_friend#" type="formfield" />
         <cfhttpparam name="is_family" value="#is_family#" type="formfield" />
      <!--- The returned XML --->
      <cfdump var="#xmlParse(cfhttp.FileContent)#" />
         <!--- If there was a problem --->
         <cfdump var="#cfcatch#" />

comments powered by Disqus