<div style="height:40px;">
</div>
 <h1>Sync File BC 41</h1>
   <form method="post" action="" id="upload_file_bc41">
      <label for="userfile_bc41">File</label>
      <input type="file" name="userfile_bc41" id="userfile_bc41" size="40" />
      <input type="submit" name="submit" id="submit" value="Upload" />
   </form>
   <hr>
   <h2>Files</h2>
   <div id="files_bc41" style="font-weight:bold;font-size:17px;"></div>
   
<script type="text/javascript">
    
    $(document).ready(function(){
	
		function refresh_files()
		{
		   $.get('<?php echo base_url().'loaderfiles/masterdata/'; ?>')
		   .success(function (data){
			  $('#files_bc41').html(data);
		   });
		};
	
		$('#userfile_bc41').live('change', function(){
			$('#files_bc41').html('<p>'+ $('#userfile_bc41').val() +'</p>'); 
		});
		
		jQuery.extend({
			handleError: function( s, xhr, status, e ) {
			// If a local callback was specified, fire it
				if ( s.error )
					s.error( xhr, status, e );
				// If we have some XML response text (e.g. from an AJAX call) then log it in the console
				else if(xhr.responseText)
					console.log(xhr.responseText);
			}
		});
		
		$(function() {
			$('#upload_file_bc41').submit(function(e) {
				e.preventDefault();
				$.ajaxFileUpload({
				 url         :'./pasi_uploadmd/ct_uploadbc41/upload_file_bc41/',
				 secureuri      :false,
				 fileElementId  :'userfile_bc41',
				 dataType    : 'json',
				 data        : {
					'userfile_bc41'  : $('#userfile_bc41').val()
				 },
				 success  : function (data, status)
				 {
					if(data.status != 'error')
					{
					   $('#files_bc41').html('<p>Sync File '+ $('#userfile_bc41').val() +' success</p>');  
					}
					alert(data.msg);
				 }
		  });
		  return false;
		   });
		});


	});
		  	
</script>



	
	