|
 |
|
ช่วยแก้โค้ดให้หน่อยครับเกี่ยวกับการเปลี่ยนชื่อไฟล์อัปโหลด |
|
 |
|
|
 |
 |
|
แล้วจะทำอย่างไรให้มันเปลี่ยนชื่อเป็นวันที่เลยหรอครับ
|
 |
 |
 |
 |
Date :
2010-11-15 20:14:20 |
By :
bp14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาแบบพื้นๆ ไปลองดูนะครับ
<form action="dbkm.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="step" value="fupfw">
<input type="hidden" name="num" value="<?php echo $num;?>">
<table width="100%">
<tr >
<td colspan="4" align="center">
:: จำนวนไฟลที่ต้องการส่ง ::
<select type ="text" name="num" onchange="submit( );" >
<?php
if($num==""){$num=1;}
for($i=1;$i<=15;$i++){
if($i==$num){ ?>
<option value="<?php echo $i;?>" selected><?php echo $i;?></option>
<?php }else{ ?>
<option value="<?php echo $i;?>" ><?php echo $i;?></option>
<?php }
}?>
</select>
</td>
</tr>
<?php
for($j=1;$j<=$num;$j++){ ?>
<tr >
<td>
<input type="file" name="ufile[<?php echo $j;?>]" size=60 >
</td>
</tr>
<?php }
<tr >
<td align="center" colspan="4">
<input type="Submit" name="step" value="UP_FILE" >
</td>
</tr>
#############################
## upload
$dat=date("Y-m-d");
$num=$_POST["num"];
for($j=1;$j<=$num;$j++){
$cp1=$_POST["cp"][$j];
$uploaddir2="dbkm/$dat"; // โฟล์เดอร์ที่เก็บไฟล์
$fileupload2=$HTTP_POST_FILES['ufile']['tmp_name'][$j];
$cnafile[$j]=$HTTP_POST_FILES['ufile']['name'][$j];
$result = count_chars($cnafile[$j],0);
for ($i=0; $i < count($result); $i++) {
if ($result[$i] != 0)
if(chr($i)=="."){$nump=$result[$i];}
}
$extf=explode(".",$cnafile[$j]);
for($i=0;$i<=$nump;$i++){
$nchoos=$extf[$nump];
}
$nufilenew=".".$nchoos;
$uploadfile2=$uploaddir2.$nufilenew;
if(copy($fileupload2,$uploadfile2)){
$picc[$j]=$dat.$nufilenew;
}
$sql="SELECT nkm FROM dbkm order BY nkm desc;";
$result=mysql_query($sql);
$dbarr=mysql_fetch_array($result);
if($dbarr){
$qnoNext=$dbarr["nkm"]+1;
}else{
$qnoNext=1;
}
if(($picc[$j]!="") and ($cp1!=="")){
$sql="INSERT INTO dbkm (nkm,nakm,fkm,dkm,ipkm,stkm) VALUES ($qnoNext,'$cp1','$picc[$j]','$dat','$IP','1');";
$result=mysql_query($sql);
}
}
|
 |
 |
 |
 |
Date :
2011-05-04 15:08:23 |
By :
choti |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|