MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /home/pathumthani_integration/integration/application/import_export/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/pathumthani_integration/integration/application/import_export/generator.form.php
<?
session_start();
$im_type="excel";
require_once('../../config/config_epm.inc.php');	

$arr_file['xml']=array('type'=>"xml",'caption'=>"Generator XML Form",'name'=>"XML File");
$arr_file['excel']=array('type'=>"xls",'caption'=>"Generator EXCEL Form",'name'=>"Excel File");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<title><?=$arr_file[$im_type]['caption']?></title>
<!--<link href="../../styles/styles.css" type=text/css rel=stylesheet />-->
</head>
<body>

<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/jquery.swfupload.js"></script>
<script type="text/javascript">

function startUpload(){
$('#swfupload-control').swfupload('startUpload');
}

$(function(){
	$('#swfupload-control').swfupload({
		upload_url: "upload-filegenerator.php",
		file_post_name: 'uploadfile',
		file_size_limit : "5120000",
		file_types : "*.<?=$arr_file[$im_type]['type']?>",	//file_types : "*.jpg;*.png;*.bmp",
		file_types_description : "DBF files",
		file_upload_limit : 1,
		flash_url : "js/swfupload/swfupload.swf",
		button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png',
		button_width : 114,
		button_height : 29,
		button_placeholder : $('#button')[0],
		debug: false
	})
		.bind('fileQueued', function(event, file){
			var listitem='<li id="'+file.id+'" >'+
				'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
				'<div class="progressbar" ><div class="progress" ></div></div>'+
				'<p class="status" >Pending</p>'+
				'<span class="cancel" >&nbsp;</span>'+
				'</li>';
			$('#log').append(listitem);
			$('li#'+file.id+' .cancel').bind('click', function(){
				var swfu = $.swfupload.getInstance('#swfupload-control');
				swfu.cancelUpload(file.id);
				$('li#'+file.id).slideUp('fast');
			});
			// start the upload since it's queued
			//$(this).swfupload('startUpload');
			document.getElementById('xmlfile').value=file.name;
		})
		.bind('fileQueueError', function(event, file, errorCode, message){
			alert('Size of the file '+file.name+' is greater than limit');
		})
		.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
			$('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);
		})
		.bind('uploadStart', function(event, file){
			$('#log li#'+file.id).find('p.status').text('Uploading...');
			$('#log li#'+file.id).find('span.progressvalue').text('0%');
			$('#log li#'+file.id).find('span.cancel').hide();
		})
		.bind('uploadProgress', function(event, file, bytesLoaded){
			//Show Progress
			var percentage=Math.round((bytesLoaded/file.size)*100);
			$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
			$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
		})
		.bind('uploadSuccess', function(event, file, serverData){			
			var item=$('#log li#'+file.id);
			item.find('div.progress').css('width', '100%');
			item.find('span.progressvalue').text('100%');
			document.getElementById('xmlfile').value=serverData;
			var pathtofile='<a href="'+file.name+'" target="_blank" >view &raquo;</a>';
			item.addClass('success').find('p.status').html('Done!!! | '+pathtofile);
			
		})
		.bind('uploadComplete', function(event, file){
			// upload has completed, try the next one in the queue
			$(this).swfupload('startUpload');
			window.location="generator.php?ProfileID="+document.getElementById('ProfileID').value+"&xmlfile="+document.getElementById('xmlfile').value+"&im_type=<?=$im_type?>";
			//alert("test");
		})
	
});	

</script>
<style type="text/css" >
#swfupload-control p{ margin:0px 0px; font-size:0.9em; }
#log{ margin:0; padding:0; width:500px;}
#log li{ list-style-position:inside; margin:2px; border:1px solid #ccc; padding:10px; font-size:12px; 
	font-family:Arial, Helvetica, sans-serif; color:#333; background:#fff; position:relative;}
#log li .progressbar{ border:1px solid #333; height:5px; background:#fff; }
#log li .progress{ background:#999; width:0%; height:5px; }
#log li p{ margin:0; line-height:18px; }
#log li.success{ border:1px solid #339933; background:#ccf9b9; }
#log li span.cancel{ position:absolute; top:5px; right:5px; width:20px; height:20px; 
	background:url('js/swfupload/cancel.png') no-repeat; cursor:pointer; }
</style>

<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#B4B4B4">
		<table width="100%" border="0" cellpadding="5" cellspacing="1">
      <tr>
        <td bgcolor="#FFFFFF" align="center">
        
<form action="generator.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
      <td align="left"><strong><?=$arr_file[$im_type]['caption']?></strong></td>
    </tr>
    <tr>
      <td><label></label>
        <table width="100%" border="0" cellspacing="0" cellpadding="3">
          <tr>
            <td width="11%" align="right"><?=$arr_file[$im_type]['name']?> : </td>
            <td width="89%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="165" align="left"><input name="xmlfile" type="text" readonly="readonly" id="xmlfile" /></td>
                <td align="left"><input type="button" id="button" /></td>
              </tr>
            </table>
              </td>
          </tr>
          <tr>
            <td align="right">&nbsp;</td>
            <td align="left">
            
            <?
				$strSQL = "SELECT * FROM tbl_xmlprofile";
				$rsConn = mysql_query($strSQL) or die(mysql_error());
				?>
				<select name="ProfileID" id="ProfileID"> 
				<?
				while($Result = mysql_fetch_array($rsConn)){
					?>
					<option value="<?=$Result[PROFILE_ID]?>"><?=$Result[COMMENT]?></option>
					<?
					}
				
			?>
            
            </select>
            <input name="ProfileID" type="text" id="ProfileID" value="<?=$ProfileID?>"  style="display:none"/></td>
          </tr>

          <tr>
            <td align="right">&nbsp;</td>
            <td align="left"><input type="button" name="Submit" value="Upload" id="boxok" style="width:80" onclick="startUpload()"/><!--<input type="submit" name="Submit" value="Import" id="boxok" style="width:80" onclick="startUpload()"/>-->
            <!--<input name="Submit2" type="button" style="width:80" value="Go to Export" onclick="location.href='xml_export.php'"/>--></td>
          </tr>
        </table>
      <label>        </label></td>
    </tr>
    <tr>
      <td><span id="swfupload-control">
              <p id="queuestatus" ></p>
                        <ol id="log"></ol>
                       
            </span></td>
    </tr>
  </table>
  
	

 <!--<input type="button" id="boxok"  value="OK" onclick="startUpload()" />-->

</form>
</td></tr></table></td></tr></table>
</body>
</html>

Anon7 - 2021