<div style="height:10px;">
</div>
  <h1>Upload File HIB</h1>
   <form method="post" action="" id="upload_file">
      <label for="userfile">File</label>
      <input type="file" name="userfile" id="userfile" size="40" />
      <input type="submit" name="submit" id="submit" value="Upload" />
   </form>
   <hr>
   <h2>Files</h2>
   <div id="files" style="font-weight:bold;font-size:17px;"></div>
<script type="text/javascript">
    
    $(document).ready(function(){
		function refresh_files()
		{
		   $.get('<?php echo base_url().'loaderfiles/invoice/hib/'; ?>')
		   .success(function (data){
			  $('#files').html(data);
		   });
		};
		$('#userfile').live('change', function(){
			$('#files').html('<p>'+ $('#userfile').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').submit(function(e) {
				e.preventDefault();
				$.ajaxFileUpload({
				 url         :'./invoice/ct_invoice/upload_file/',
				 secureuri      :false,
				 fileElementId  :'userfile',
				 dataType    : 'json',
				 data        : {
					'userfile'  : $('#userfile').val()
				 },
				 success  : function (data, status)
				 {
					if(data.status != 'error')
					{
					   $('#files').html('<p>Upload File Sukses...'+ $('#userfile').val() +'</p>'); 
					   jQuery("#tbluploadinvoice").trigger('reloadGrid');
					 
					}
					alert(data.msg);
				 }
		  });
		  return false;
		   });
		});

	});
		  	
</script>



	
	