However as pointed in an earlier mail to this post only if i comment the following lines
txtContent.Setting["CuteEditorFileStorageType"]=typeof(SqlFileStorage).AssemblyQualifiedName;
txtContent.Setting["DownFile"]=ResolveUrl("../Webforms/DownFile.Aspx");
txtContent.SetSecurityGalleryPath("/");
and write the following line on the pageload, everything works fine, and the new template is uploaded
txtContent.SetSecurityTemplateGalleryPath("~/templates");