data import and upload issues
diff --git a/erpnext/home/page/profile_settings/profile_settings.js b/erpnext/home/page/profile_settings/profile_settings.js
index 667265e..e9cd81f 100644
--- a/erpnext/home/page/profile_settings/profile_settings.js
+++ b/erpnext/home/page/profile_settings/profile_settings.js
@@ -108,44 +108,42 @@
 	this.change_image = function() {
 		var d = new wn.widgets.Dialog({
 			title: 'Set your Profile'
-		})
-		me.uploader = new Uploader(d.body, {
-				modulename:'home.page.profile_settings.profile_settings',
-				method: 'set_user_image'
-			}, 
-			pscript.user_image_upload, 1)
+		});
+		
+		wn.upload.make({
+			parent: d.body,
+			args: {
+				method: 'home.page.profile_settings.profile_settings.set_user_image'
+			},
+			callback: function(fid) {
+				if(fid) {
+					d.hide();
+					wn.boot.user_info[user].image = 'files/' + fid;
+					pscript.myprofile.img.src = 'files/' + fid;
+				}
+			}
+		});
 		d.show();
-		pscript.open_dialog = d;
 	}
 	
 	this.change_background = function() {
 		var d = new wn.widgets.Dialog({
 			title: 'Set Background Image'
 		})
-		me.uploader = new Uploader(d.body, {
-				modulename:'home.page.profile_settings.profile_settings',
-				method: 'set_user_background'
-			}, 
-			pscript.background_change, 1)
+
+		wn.upload.make({
+			parent: d.body,
+			args: {
+				method: 'home.page.profile_settings.profile_settings.set_user_background'
+			},
+			callback: function(fid) {
+				if(fid) {
+					d.hide();
+					erpnext.set_user_background(fid);		
+				}				
+			}
+		});				
 		d.show();
-		pscript.open_dialog = d;
 	}
 	this.make();
-}
-
-pscript.background_change = function(fid) {
-	msgprint('File Uploaded');
-	if(fid) {
-		erpnext.set_user_background(fid);		
-		pscript.open_dialog.hide();
-	}
-}
-
-pscript.user_image_upload = function(fid) {
-	msgprint('File Uploaded');
-	if(fid) {
-		pscript.open_dialog.hide();
-		wn.boot.user_info[user].image = 'files/' + fid;
-		pscript.myprofile.img.src = 'files/' + fid;
-	}
-}
+}
\ No newline at end of file
diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py
index 631d22a..4e48eee 100644
--- a/erpnext/home/page/profile_settings/profile_settings.py
+++ b/erpnext/home/page/profile_settings/profile_settings.py
@@ -64,14 +64,16 @@
 	webnotes.msgprint('Updated')
 
 @webnotes.whitelist()
-def set_user_image(fid, fname):
+def set_user_image():
 	"""
 		Set uploaded image as user image
 	"""
 	check_demo()
-	from webnotes.utils.file_manager import add_file_list, remove_file
+	from webnotes.utils.file_manager import add_file_list, remove_file, save_uploaded
 	user = webnotes.session['user']
-	
+
+	fid, fname = save_uploaded()
+		
 	# remove old file
 	old_image = webnotes.conn.get_value('Profile', user, 'user_image')
 	if old_image:
@@ -80,15 +82,19 @@
 	# add new file
 	add_file_list('Profile', user, fname, fid)
 	webnotes.conn.set_value('Profile', user, 'user_image', fid)
+	
+	return fid
 
 @webnotes.whitelist()	
-def set_user_background(fid, fname):
+def set_user_background():
 	"""
 		Set uploaded image as user image
 	"""
 	check_demo()
-	from webnotes.utils.file_manager import add_file_list, remove_file
+	from webnotes.utils.file_manager import add_file_list, remove_file, save_uploaded
 	user = webnotes.session['user']
+
+	fid, fname = save_uploaded()
 	
 	# remove old file
 	old_image = webnotes.conn.get_value('Profile', user, 'background_image')
@@ -98,3 +104,5 @@
 	# add new file
 	add_file_list('Profile', user, fname, fid)
 	webnotes.conn.set_value('Profile', user, 'background_image', fid)
+	
+	return fid
diff --git a/public/css/all-app.css b/public/css/all-app.css
index a7a8b3b..853f677 100644
--- a/public/css/all-app.css
+++ b/public/css/all-app.css
@@ -3686,7 +3686,7 @@
 	margin-bottom: 7px;
 	background-color: #fff;
 	height: 18px;
-	border: 2px solid #aaa;
+	border: 1px solid #aaa;
 	border-radius: 9px;
 	overflow: hidden;
 }
diff --git a/public/css/all-web.css b/public/css/all-web.css
index 27f81df..c54d72b 100644
--- a/public/css/all-web.css
+++ b/public/css/all-web.css
@@ -2438,7 +2438,7 @@
 	margin-bottom: 7px;
 	background-color: #fff;
 	height: 18px;
-	border: 2px solid #aaa;
+	border: 1px solid #aaa;
 	border-radius: 9px;
 	overflow: hidden;
 }
diff --git a/public/js/all-app.js b/public/js/all-app.js
index da03ffc..4557975 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -153,7 +153,8 @@
 /*
  *	lib/js/wn/dom.js
  */
-wn.provide('wn.dom');wn.dom={id_count:0,by_id:function(id){return document.getElementById(id);},set_unique_id:function(ele){var id='unique-'+wn.dom.id_count;ele.setAttribute('id',id);wn.dom.id_count++;return id;},eval:function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);},set_style:function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
+wn.provide('wn.dom');wn.dom={id_count:0,by_id:function(id){return document.getElementById(id);},set_unique_id:function(ele){var id='unique-'+wn.dom.id_count;if(ele)
+ele.setAttribute('id',id);wn.dom.id_count++;return id;},eval:function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);},set_style:function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
 document.getElementsByTagName('head')[0].appendChild(se);},add:function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent)
 parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
 c.src=className
@@ -931,6 +932,17 @@
 this.load();},addnode:function(label,expandable){if(!this.$ul){this.$ul=$('<ul>').toggle(false).appendTo(this.parent);}
 return new wn.ui.TreeNode({tree:this.tree,parent:$('<li>').appendTo(this.$ul),label:label,expandable:expandable});},load:function(){var me=this;args=$.extend(this.tree.args,{parent:this.label});$(me.$a).set_working();wn.call({method:this.tree.method,args:args,callback:function(r){$(me.$a).done_working();$.each(r.message,function(i,v){node=me.addnode(v.value||v,v.expandable);node.$a.data('node-data',v);});me.loaded=true;me.selectnode();}})}})
 /*
+ *	lib/js/wn/upload.js
+ */
+wn.upload={make:function(opts){var id=wn.dom.set_unique_id();$(opts.parent).append(repl('<iframe id="%(id)s" name="%(id)s" src="blank.html" \
+    style="width:0px; height:0px; border:0px"></iframe>\
+   <form method="POST" enctype="multipart/form-data" \
+    action="%(action)s" target="%(id)s">\
+    <input type="file" name="filedata" /><br>\
+    <input type="submit" class="btn btn-small" value="Upload" />\
+   </form>',{id:id,action:wn.request.url}));opts.args.cmd='uploadfile';opts.args._id=id;for(key in opts.args){if(opts.args[key]){$('<input type="hidden">').attr('name',key).attr('value',opts.args[key]).appendTo($(opts.parent).find('form'));}}
+$('#'+id).get(0).callback=opts.callback},callback:function(id,file_id,args){$('#'+id).get(0).callback(file_id,args);}}
+/*
  *	lib/js/wn/misc/about.js
  */
 wn.provide('wn.ui.misc');wn.ui.misc.about=function(){if(!wn.ui.misc.about_dialog){var d=new wn.widgets.Dialog({title:'About wnframework'})
@@ -1273,14 +1285,6 @@
 var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
 function loaddocbrowser(dt){wn.set_route('List',dt);}
 /*
- *	lib/js/legacy/webpage/uploader.js
- */
-var uploaders={};var upload_frame_count=0;Uploader=function(parent,args,callback){var id='frame'+upload_frame_count;upload_frame_count++;this.callback=callback;var div=$a(parent,'div');div.innerHTML='<iframe id="'+id+'" name="'+id+'" src="blank.html" \
-  style="width:0px; height:0px; border:0px"></iframe>';var div=$a(parent,'div');div.innerHTML='<form method="POST" enctype="multipart/form-data" action="'+wn.request.url+'" target="'+id+'"></form>';var ul_form=div.childNodes[0];var f_list=[];var inp_fdata=$a_input($a(ul_form,'span'),'file',{name:'filedata'},{marginLeft:'7px'});if(!('cmd'in args)){var inp=$a_input($a(ul_form,'span'),'hidden',{name:'cmd'});inp.value='uploadfile';}
-var inp=$a_input($a(ul_form,'span'),'hidden',{name:'uploader_id'});inp.value=id;var inp=$a_input($a(ul_form,'span'),'submit',null,{marginLeft:'7px'});inp.value='Upload';$y(inp,{width:'80px'});for(var key in args){var inp=$a_input($a(ul_form,'span'),'hidden',{name:key});inp.value=args[key];}
-uploaders[id]=this;}
-function upload_callback(id,fid){uploaders[id].callback(fid);}
-/*
  *	lib/js/legacy/wn/page_layout.js
  */
 wn.PageLayout=function(args){$.extend(this,args)
@@ -1412,7 +1416,7 @@
 /*
  *	lib/js/wn/ui/toolbar/report.js
  */
-wn.ui.toolbar.Report=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Start Report For",execute:function(val){loadreport(val,null,null,null,1);},});this.set_values(profile.can_get_report.join(',').split(','));}});
+wn.ui.toolbar.Report=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Start Report For",execute:function(val){wn.set_route('Report2',val);},});this.set_values(profile.can_get_report.join(',').split(','));}});
 /*
  *	lib/js/wn/ui/toolbar/recent.js
  */
@@ -2211,7 +2215,7 @@
 this.add_attachment=function(){if(!this.dialog){this.dialog=new wn.widgets.Dialog({title:'Add Attachment',width:400})
 $y(this.dialog.body,{margin:'13px'})
 this.dialog.make();}
-this.dialog.body.innerHTML='';this.dialog.show();this.uploader=new Uploader(this.dialog.body,{from_form:1,doctype:doctype,docname:docname,at_id:this.at_id},wn.widgets.form.file_upload_done);}
+this.dialog.body.innerHTML='';this.dialog.show();wn.upload.make({parent:this.dialog.body,args:{from_form:1,doctype:doctype,docname:docname},callback:wn.widgets.form.file_upload_done});}
 this.make();}
 wn.widgets.form.sidebar.Attachment=function(parent,filedet,frm){filedet=filedet.split(',')
 this.filename=filedet[0];this.fileid=filedet[1];this.frm=frm;var me=this;this.wrapper=$a(parent,'div','sidebar-comment-message');this.remove_fileid=function(){var doc=locals[me.frm.doctype][me.frm.docname];var fl=doc.file_list.split('\n');new_fl=[];for(var i=0;i<fl.length;i++){if(fl[i].split(',')[1]!=me.fileid)new_fl.push(fl[i]);}
@@ -2220,7 +2224,7 @@
 display_name=this.filename;this.ln=$a(this.wrapper,'a','link_type small',{},display_name);this.ln.href='files/'+this.fileid;this.ln.target='_blank';this.del=$a(this.wrapper,'span','close','','&#215;');this.del.onclick=function(){var yn=confirm("Are you sure you want to delete the attachment?")
 if(yn){var callback=function(r,rt){locals[me.frm.doctype][me.frm.docname].modified=r.message;$dh(me.wrapper);me.remove_fileid();frm.refresh();}
 $c('webnotes.widgets.form.utils.remove_attach',args={'fid':me.fileid,dt:me.frm.doctype,dn:me.frm.docname},callback);}}}
-wn.widgets.form.file_upload_done=function(doctype,docname,fileid,filename,at_id,new_timestamp){var at_id=cint(at_id);var doc=locals[doctype][docname];if(doc.file_list){var fl=doc.file_list.split('\n')
+wn.widgets.form.file_upload_done=function(doctype,docname,fileid,filename,at_id,new_timestamp){var doc=locals[doctype][docname];if(doc.file_list){var fl=doc.file_list.split('\n')
 fl.push(filename+','+fileid)
 doc.file_list=fl.join('\n');}
 else
diff --git a/public/js/all-web.js b/public/js/all-web.js
index cfc2f55..72ab35d 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -40,7 +40,8 @@
 /*
  *	lib/js/wn/dom.js
  */
-wn.provide('wn.dom');wn.dom={id_count:0,by_id:function(id){return document.getElementById(id);},set_unique_id:function(ele){var id='unique-'+wn.dom.id_count;ele.setAttribute('id',id);wn.dom.id_count++;return id;},eval:function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);},set_style:function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
+wn.provide('wn.dom');wn.dom={id_count:0,by_id:function(id){return document.getElementById(id);},set_unique_id:function(ele){var id='unique-'+wn.dom.id_count;if(ele)
+ele.setAttribute('id',id);wn.dom.id_count++;return id;},eval:function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);},set_style:function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
 document.getElementsByTagName('head')[0].appendChild(se);},add:function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent)
 parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
 c.src=className