 		if af &&  af.submitType == 'insert'
 			doc = af.doc
 
+		parentData = Template.parentData(0).value or Template.parentData(4).value
 		if Session.equals('fileUpload['+name+']', 'delete-file')
 			return null
 		else if Session.get('fileUpload['+name+']')
 			file = Session.get('fileUpload['+name+']')
-		else if Template.parentData(4).value
-			file = Template.parentData(4).value
+		else if parentData
+			file = parentData
 		else
 			return null
 

			console.log doc
			doc
		else
			null
				filename = file
				src = filename
		if filename
			obj =
				template: getTemplate(filename)
				data:
					src: src
