  | 
              
	              
	                
  
    
	 
        ไฟล์ที่ upload ขึ้นไปบนเว็บไม่โชว์ชื่อไฟล์ที่ให้ Download     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เอาโค๊ดตัวส่งและรับ มาดูครับ ไม่รู้ว่าทำอะไรไปแล้วบ้าง 
 
โดยปกติ $_FILES['tagName']['name'] จะเป็นชื่อไฟล์ที่อัพโหลดครับ 
ก็เอาตัวแปรนี้มาใช้ได้ครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-08 10:52:40 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 โค้ดจะประมาณนี้นะครับ  
 
Code 
<?php 
/* 
	Copyright (c) InterAKT Online 2000-2006. All rights reserved. 
*/ 
include_once(dirname(realpath(__FILE__)) . '/../../common/lib/resources/KT_Resources.php'); 
 
// Load the tNG classes 
require_once(dirname(realpath(__FILE__)) . '/../tNG.inc.php'); 
 
// includes business logic 
require_once('multiple_upload.inc.php'); 
 
if (!isset($uploadHash)) { 
	die('Internal Error. Session expired.'); 
} 
 
// Multiple Upload Helper Object 
$muploadHelper = new tNG_MuploadHelper('../../../', 95); 
$muploadHelper->setMaxSize($uploadHash['maxSize']); 
$muploadHelper->setMaxNumber($uploadHash['maxFiles']); 
$muploadHelper->setExistentNumber($totalRows_rsFiles); 
$muploadHelper->setAllowedExtensions(implode(',', $uploadHash['allowedExtensions'])); 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
	<link href="../../../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /> 
	<link href="multiple_upload.css" rel="stylesheet" type="text/css" media="all" /> 
	<title>Multiple Upload</title> 
    <script src="../../../includes/common/js/base.js" type="text/javascript"></script> 
    <script src="../../../includes/common/js/utility.js" type="text/javascript"></script> 
	<?php echo $muploadHelper->getScripts(); ?> 
</head> 
<body> 
 
<div class="top"> 
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="KT_tngtable"> 
<tr><th> 
    <h1><?php echo $listFolder->getTotalRecords(); ?> <?php echo KT_getResource('FILES','tNG'); ?>  
        <?php 
        // Show IF Conditional region1  
        if ($uploadHash['maxFiles'] != '' && $uploadHash['maxFiles'] != 0) { 
        ?> 
        (<?php echo KT_getResource('MAXFILES','tNG'); ?> <?php echo $uploadHash['maxFiles']; ?> <?php echo KT_getResource('FILES','tNG'); ?>) 
        <?php }  
        // endif Conditional region1 
        ?> 
    </h1> 
    </th></tr> 
<tr> 
<td align="right"> 
<?php 
// Show IF Conditional region3  
if (!isset($uploadHash['maxFiles']) || $uploadHash['maxFiles']==0 || $uploadHash['maxFiles'] > $totalRows_rsFiles) { 
?> 
<?php 
echo $muploadHelper->Execute(); 
?> 
 <?php }  
// endif Conditional region3 
?> 
</td> 
</tr> 
</table> 
</div> 
<div class="middle"> 
	    <?php  
    // Show IF Conditional region2  
    if (isset($err)) { 
    ?>	 
        <div id="KT_tngerror"><label><?php echo KT_getResource('ERROR_LABEL','tNG'); ?></label> 
            <div><?php echo ($GLOBALS['tNG_debug_mode'] == 'DEVELOPMENT' ? $err[1] : $err[0]); ?></div> 
        </div> 
      <?php }  
    // endif Conditional region2 
    ?> 
    <?php  
    // Show IF Conditional region6  
    if (isset($_SESSION['tng_upload']['errorForFlash']) && $_SESSION['tng_upload']['errorForFlash']!='' && !isset($_GET['isFlash'])) { 
    ?>	 
        <div id="KT_tngerror"><label><?php echo KT_getResource('ERROR_LABEL','tNG'); ?></label> 
            <div><?php echo $_SESSION['tng_upload']['errorForFlash']; ?></div> 
        </div> 
        <?php unset($_SESSION['tng_upload']['errorForFlash']); ?>	 
      <?php }  
    // endif Conditional region6 
    ?> 
		<table border="0" width="90%" cellpadding="0" cellspacing="0" class="KT_tngtable" > 
		<thead> 
		<tr class="KT_row_order"> 
			<?php  
			// Show IF Conditional region90 
			if (isset($uploadHash['thumbnail']['popupWidth']) && isset($uploadHash['thumbnail']['popupHeight'])) { 
			?>				 
				<th>Preview</th> 
						 <?php }  
// endif Conditional region90 
?>		 
			<th>Name</th> 
			<th>Date</th> 
			<th>Size</th> 
			<th> </th> 
		</tr> 
		</thead> 
 
				<?php if ($totalRows_rsFiles == 0) { // Show if recordset empty ?> 
					<tr  style="height:350px;"><td colspan="5" align="center" valign="center" class="emptyTable"><?php echo KT_getResource('EMPTY_MUP_POPUP','tNG'); ?></td></tr> 
	 
  <?php } // Show if recordset empty ?> 
		 
		<?php if ($totalRows_rsFiles > 0) { // Show if recordset not empty ?> 
<?php  
$i = 1; 
 while (!$rsFiles->EOF) {  
?> 
			<tr class="<?php echo ( ($i%2 == 0) ? 'KT_even' : 'KT_odd'); ?>"> 
				 
				<td> 
					<?php  
// Show IF Conditional region4  
if (isset($uploadHash['thumbnail']['popupWidth']) && isset($uploadHash['thumbnail']['popupHeight'])) { 
?>				 
						<a href="<?php echo $objDynamicThumb1->getPopupLink(); ?>" onclick="<?php echo $objDynamicThumb1->getPopupAction(); ?>" target="_blank"> 
					 <?php }  
// endif Conditional region4 
?> 
					<?php  
// Show IF Conditional region5  
if (isset($uploadHash['thumbnail']['width']) && isset($uploadHash['thumbnail']['height'])) { 
?>									 
						<img src="<?php echo $objDynamicThumb1->Execute();?>" alt="<?php echo KT_getResource('CLICK_ENLARGE','tNG'); ?>" title="<?php echo KT_getResource('CLICK_ENLARGE','tNG'); ?>" border="0" /> 
					  <?php  
// else Conditional region5 
} else { ?> 
						<?php echo $rsFiles->Fields('name'); ?> 
					<?php }  
// endif Conditional region5 
?> 
							<?php  
// Show IF Conditional region6  
if (isset($uploadHash['thumbnail']['popupWidth']) && isset($uploadHash['thumbnail']['popupHeight'])) { 
?>	 
						</a> 
					<?php }  
// endif Conditional region6 
?> 
				</td> 
				<?php 
// Show IF Conditional region99  
if (isset($uploadHash['thumbnail']['width']) && isset($uploadHash['thumbnail']['height'])) { 
?>				 
				<td> 
				<?php echo $rsFiles->Fields('name'); ?> 
				</td> 
<?php }  
// endif Conditional region99 
?>				 
				<td><?php echo $rsFiles->Fields('date'); ?></td><td> <?php echo number_format($rsFiles->Fields('size'), 0, '', ',' ); ?> bytes</td> 
				<td> 
					<form method="post" action="<?php echo KT_getFullUri(); ?>" enctype="multipart/form-data" class="tNG_deleteBtnForm"> 
						<input type="hidden" name="delete" value="<?php $_SESSION['tng_upload_delete'][] = $rsFiles->Fields('name'); echo (count($_SESSION['tng_upload_delete']) - 1); ?>" /> 
      					<input type="submit" name="KT_del" value="<?php echo KT_getResource('DELETE','tNG'); ?>" class="KT_delete_link button_smallest" onClick = "if (!confirm('Are you sure you want to delete?')) return false;" /> 
					</form> 
					</td> 
			</tr> 
<?php 
    $rsFiles->MoveNext();  
  } 
?> 
  <?php } // Show if recordset not empty ?> 
		</table> 
 
</div> 
<div class="bottom" > 
<table width="100%" class="KT_tngtable" cellpadding="0" cellspacing="0"> 
<tr class="KT_buttons"> 
        <th> 
            <input type="button" value="<?php echo KT_getResource('CLOSE','tNG'); ?>" onClick = "window.close()" /> 
        </th> 
    </tr> 
</table> 
</div> 
</body> 
</html>                         
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2014-07-08 11:43:38 2014-07-08 11:43:55              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-08 11:42:14 | 
                        By :
                            thelak | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 แหม่ สีเหมือนกันเลย เอา php code ครอบดีกว่าไหมครับ 5555 
 
 
ปล. ผมคงช่วยไหม่ได้ครับ ผมไม่เคยใช้  
Code (PHP) 
// includes business logic
require_once('multiple_upload.inc.php');
if (!isset($uploadHash)) {
die('Internal Error. Session expired.');
}
// Multiple Upload Helper Object
$muploadHelper = new tNG_MuploadHelper('../../../', 95);
 
 
 
ปล.อีกเที่ยว 
ผมใช้แต่แบบนี้ครับ 
 
Code (PHP) 
<?php
$uploads_dir = '/uploads';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
        $name = $_FILES["pictures"]["name"][$key];
        move_uploaded_file($tmp_name, "$uploads_dir/$name");
    }
}
?> 
                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2014-07-08 11:50:28 2014-07-08 11:53:26              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-08 11:46:29 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมก็ไม่รู้จะแก้ตรงไหนครับ  ขอบคุณครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-08 11:54:55 | 
                        By :
                            thelak | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 งั้นลองเอาไฟล์นี้มาโชว์ด้วยครับ 
require_once('multiple_upload.inc.php'); 
 
แก้คลาสเล่นซักวัน 5555                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-08 11:57:49 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
/*
	Copyright (c) InterAKT Online 2000-2006. All rights reserved.
*/
foreach ($_GET as $reference => $uploadID) {
	if (preg_match("/^KT_upload(.*)/is", $reference)) {
		break;	
	}	
}
if (!isset($uploadID)) {
	return null;
}
if (!isset($_SESSION['tng_upload'][$reference])) {
	return null;
}
if (!isset($_SESSION['tng_upload'][$reference]['files'][$uploadID])) {
	return null;
}
$uploadHash = $_SESSION['tng_upload'][$reference]['properties'];
$uploadHashFile = $_SESSION['tng_upload'][$reference]['files'][$uploadID];
// recover connection
require_once(dirname(__FILE__) . '/../../../Connections/' . $uploadHash['connName'] . '.php');
if (is_resource($$uploadHash['connName'])) {
    $database = 'database_'.$uploadHash['connName'];
    $KT_conn_mupload = new KT_connection($$uploadHash['connName'], $$database);
    $isMysql = 1;
} else {
	$KT_conn_mupload = $$uploadHash['connName'];	
}
//print_r($uploadHash);
$folder = $uploadHashFile['folder'];
if (substr($folder, -1, 1) != '/' || substr($folder, -1, 1) != '\\') {
	$folder .= '/';
}
if ($uploadHash['relPath'] != '') {
	if (substr($folder, 0, strlen($uploadHash['relPath']))==$uploadHash['relPath']) {
		$folder = substr($folder, strlen($uploadHash['relPath']));
	}	
}
$folder = '../../../'. $folder;
// create the folder if not exists
if (!file_exists($folder)) {
	$folderObj = new KT_folder();
	$folderObj->createFolder($folder);
	if ($folderObj->hasError()) {
		$err = $folderObj->getError();
		echo '<html><head><title>Multilpe Upload</title><link href="../../../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /></head><body><div id="KT_tngerror"><label>'.KT_getResource('ERROR_LABEL','tNG').'</label><div>';
		echo ((isset($GLOBALS['tNG_debug_mode']) && $GLOBALS['tNG_debug_mode'] == 'DEVELOPMENT') ? $err[1] : $err[0]);
		echo '</div></div></body></html>';
		exit;
	}
} 
// delete selected file
if (isset($_POST['delete']) && isset($_SESSION['tng_upload_delete'][$_POST['delete']])) {
	$file = new KT_file();
	$file->deleteFile($folder . $_SESSION['tng_upload_delete'][$_POST['delete']]);
	if ($file->hasError()) {
		$err = $file->getError();		
	} else {
		// delete thumbnails
		tNG_deleteThumbnails($folder.'/thumbnails/', $_SESSION['tng_upload_delete'][$_POST['delete']], '');		
	}
	$_SESSION['tng_upload_delete'] = array();
	KT_redir(KT_getFullUri());
}
$_SESSION['tng_upload_delete'] = array();
// upload the files;
if (isset($_FILES['Filedata'])) {
	$folderObj = new KT_folder();
	$entries = $folderObj->readFolder($folder);
	if ($uploadHash['maxFiles']==0 || (isset($uploadHash['maxFiles']) && isset($entries['files']) && count($entries['files']) < $uploadHash['maxFiles']) || !isset($uploadHash['maxFiles']) || !isset($entries['files'])) {
		$fileUpload = new KT_fileUpload();
		$fileUpload->setFileInfo('Filedata');
		$fileUpload->setFolder($folder);
		$fileUpload->setRequired(true);
		$fileUpload->setAllowedExtensions($uploadHash['allowedExtensions']);
		$fileUpload->setAutoRename(true);
		$fileUpload->setMaxSize($uploadHash['maxSize']);
		$fileName = $fileUpload->uploadFile($_FILES['Filedata']['name'], '');
		if (!isset($_GET['isFlash']) && $fileUpload->hasError()) {
			$err = $fileUpload->getError();		
		}
		if (isset($_GET['isFlash']) && $fileUpload->hasError()) {
			$err = $fileUpload->getError();
			!isset($_SESSION['tng_upload']['errorForFlash']) ? $_SESSION['tng_upload']['errorForFlash'] = '' : '';
			if ($GLOBALS['tNG_debug_mode'] == 'DEVELOPMENT') {
				$_SESSION['tng_upload']['errorForFlash'] .= $err[1] .'<br/>';
			} else {
				$_SESSION['tng_upload']['errorForFlash'] .= $err[0] .'<br/>';
			}			
		}	
		// make the resize
		if (isset($uploadHash['isImage']) && $uploadHash['isImage'] == true  && !$fileUpload->hasError() && isset($uploadHash['resize']) && count($uploadHash['resize']) > 0) {
			$image = new KT_image();
			$image->setPreferedLib($GLOBALS['tNG_prefered_image_lib']);
			$image->addCommand($GLOBALS['tNG_prefered_imagemagick_path']);
			$image->resize($folder.$fileName, $folder, $fileName, $uploadHash['resize']['width'], $uploadHash['resize']['height'], $uploadHash['resize']['keepProportion']);
			if ($image->hasError()) {
				$err = $image->getError();	
				if (isset($_GET['isFlash'])) {
					!isset($_SESSION['tng_upload']['errorForFlash']) ? $_SESSION['tng_upload']['errorForFlash'] = '' : '';
					if ($GLOBALS['tNG_debug_mode'] == 'DEVELOPMENT') {
						$_SESSION['tng_upload']['errorForFlash'] .= $err[1] .'<br/>';
					} else {
						$_SESSION['tng_upload']['errorForFlash'] .= $err[0] .'<br/>';
					}
				}
				// delete picture
				$file = new KT_File();
				$file->deleteFile($folder.$fileName);
				if ($file->hasError()) {
					$arr = $file->getError();
					$err[0] .= '<br/>' . $arr[0];
					$err[1] .= '<br/>' . $arr[1];					
					if (isset($_GET['isFlash'])) {
					!isset($_SESSION['tng_upload']['errorForFlash']) ? $_SESSION['tng_upload']['errorForFlash'] = '' : '';
					if ($GLOBALS['tNG_debug_mode'] == 'DEVELOPMENT') {
						$_SESSION['tng_upload']['errorForFlash'] .= $err[1] .'<br/>';
					} else {
						$_SESSION['tng_upload']['errorForFlash'] .= $err[0] .'<br/>';
					}
				}
				}		
			}
		} 
	} else {
		if (isset($_GET['isFlash'])) {
			!isset($_SESSION['tng_upload']['errorForFlash']) ? $_SESSION['tng_upload']['errorForFlash'] = '' : '';
			$_SESSION['tng_upload']['errorForFlash'] .= KT_getResource('MAX_FILES_NO_REACHED', 'tNG', array($uploadHash['maxFiles'])) . '<br/>';
		}	
	}	
}
// end page execution if we are calling from flash;
if (isset($_GET['isFlash'])) {
	echo " ";
	exit;
}
	
//folder recordset
$listFolder =  new tNG_FileListRecordset("../../../", $KT_conn_mupload);
$listFolder->setBaseFolder($folder);
$listFolder->setFolder("");
$listFolder->setAllowedExtensions(implode(',', $uploadHash['allowedExtensions']));
$listFolder->setOrder('name', 'ASC');
//create the fake recordset
if (isset($isMysql)) {
	$tmp = $listFolder->Execute();
	if (!is_resource($tmp)) {
		die('Internal error');
	}
	$rsFiles = new KT_Recordset($tmp);
} else {
	$rsFiles = $listFolder->Execute();
	if (!is_object($rsFiles)) {
		die('Internal error');
	}
}
$totalRows_rsFiles = $rsFiles->RecordCount();
// end folder recordset
if ((isset($uploadHash['thumbnail']['width']) && isset($uploadHash['thumbnail']['height'])) || (isset($uploadHash['thumbnail']['popupWidth']) && isset($uploadHash['thumbnail']['popupHeight']))) {
	$objDynamicThumb1 = new tNG_DynamicThumbnail("../../../", "KT_thumbnail_" . $reference);
	$objDynamicThumb1->setFolder($folder);
	$objDynamicThumb1->setRenameRule("{rsFiles.name}");
	if (isset($uploadHash['thumbnail']['width']) && isset($uploadHash['thumbnail']['height'])) {
		$objDynamicThumb1->setResize($uploadHash['thumbnail']['width'], $uploadHash['thumbnail']['height'], true);
	}
	if (isset($uploadHash['thumbnail']['popupWidth']) && isset($uploadHash['thumbnail']['popupHeight'])) {	
		$objDynamicThumb1->setPopupSize($uploadHash['thumbnail']['popupWidth'], $uploadHash['thumbnail']['popupHeight'], true);
		$objDynamicThumb1->setPopupNavigation(false);
	}
}
?>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2014-07-09 11:54:12 | 
                        By :
                            thelak | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |