<cfinclude template="config.cfm">

<cfif isdefined('url.uploadphoto')>

	<cfset flickr = createobject("component", "CFlickr.Flickr")>
	<cfset flickr.init(apikey, secret, token)>
	
	<cfset uploadInterface = flickr.getUploadInterface()>
	
	<cfset photo_id = UploadInterface.uploadPhoto(
		expandpath("CFlickr_Test_Image.jpg"),
		"CFlickr Test Image", 
		"This is a test image uploaded by the CFlickr examples", 
		"CFlickr,Test,Woo,Yay,Hoopla!", 
		0, 0, 0, 0 )>


</cfif>


<cfinclude template="header.cfm">

<h3>Upload Example</h3>

<p><img src="CFlickr_Test_Image.jpg" width="291" height="163" align="left" style="padding:5px;" />Click below to upload this image to your Flickr account, you will need to have requested &quot;write&quot; permissions and set the token for your API Key in config.cfm</p>
<p><a href="example8.cfm?uploadphoto=true">Upload This Image </a></p>


<cfif isdefined('photo_id')>

	<p style="clear:both;">
	Photo successfully uploaded!
	
	<cfset photoInterface = flickr.getPhotosInterface()>
	<cfset photo = photoInterface.getInfo(photo_id)>
	<cfset photo_url = photo.getUrls('photopage')>
	<cfif arraylen(photo_url)>
		<cfset photo_url = photo_url[1]>
		Click <a href="<cfoutput>#photo_url.getUrl()#</cfoutput>">here</a> to view it on Flickr.
	</cfif>
	</p>
	
</cfif>