 				collection_id = Random.id()
 
 				# Send data
-				xhr = new XMLHttpRequest()
+				Cloudinary.xhr = new XMLHttpRequest()
 
-				xhr.upload.addEventListener "progress", (event) ->
+				Cloudinary.xhr.upload.addEventListener "progress", (event) ->
 						Cloudinary.collection.upsert _id:collection_id,
 							$set:
 								status:"uploading"


					callback and callback response,null

				xhr.addEventListener "abort", ->
					Cloudinary.collection.upsert collection_id,
						$set:
							status:"aborted"

				xhr.open "POST",result.form_attrs.action,true

				xhr.send form_data

			else
				return callback and callback error,null


# Define helpers
Template.registerHelper "c", ->
	Cloudinary._helpers