|
 |
|
แนะนำหน่อยครับ : ไฟล์ในฐานข้อมูลเป็น docx แต่พอกดดาวน์โหลดกลายเป็น Zip ไฟล์ |
|
 |
|
|
 |
 |
|
ตอนคุณ upload ไฟล์แปลงเป็น .zip หรือเปล่าครับ ลองเอา code upload มาดูครับ
|
 |
 |
 |
 |
Date :
2010-06-03 23:19:07 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค้ด....upload
Code (PHP)
<?
$idns=$_POST[idns];
$name=$_POST[name];
$plan=$_POST[plan];
include "connect.php";
mysql_connect($host,$user,$pw) or die("ติดต่อServer ไม่ได้");
mysql_select_db($dbname) or die("ติอต่อฐานข้อมูลไม่ได้");
mysql_query("SET character_set_results=tis620");
mysql_query("SET character_set_client='tis620'");
mysql_query("SET character_set_connection='tis620'");
mysql_query("collation_connection = tis620_thai_ci");
mysql_query("collation_database = tis620_thai_ci");
mysql_query("collation_server = tis620_thai_ci");
for($i=0;$i<count($_FILES["filUpload"]["name"]);$i++)
{if($_FILES["filUpload"]["name"][$i] != "")
$new_name=$idns."_".$_FILES["filUpload"]["name"][$i];
$path= "myfile/".$new_name;
{
if(copy($_FILES['filUpload']['tmp_name'][$i], $path))
{
$DateNow=Date("d_m_Y_H_i");
$tmp_file =$_FILES['filUpload']['tmp_name'][$i];
$fileme=$_FILES['filUpload']['name'][$i];
mysql_query("SET character_set_results=tis620");
mysql_query("SET character_set_client='tis620'");
mysql_query("SET character_set_connection='tis620'");
mysql_query("collation_connection = tis620_thai_ci");
mysql_query("collation_database = tis620_thai_ci");
mysql_query("collation_server = tis620_thai_ci");
$sql = "select * from pdffile where idns like '%$idns%' and filename like '%$new_name%' " ;
$result = mysql_query($sql) or die ("การเชื่อมต่อมีปัญหา") ;
if($result) {
$num = mysql_num_rows($result) ;
if($num>0) {
echo "<script>alert ('เอกสารซ้ำ');history.back();</script>";
}
else {
//*** Insert Record ***/
$strSQL = "INSERT INTO pdffile ";
$strSQL .="(idns ,name ,plan,filename,dateupload )VALUES '$idns','$name','$plan','$new_name','$DateNow')";
$objQuery = mysql_query($strSQL);
}}}}}
?>
<form action="main.php" method="post" name="formre">
<tr>
<td height="40" colspan="4"><div align="center"><span class="style41">เอกสารถูกจัดเก็บเรียบร้อย</span></div></td>
</tr>
<br><br>
<tr>
<td height="36" colspan="4"> <div align="center"><span class="style41">
<input name="submit" type="submit" class="style41" id="submit" value="เพิ่มข้อมูล">
</span></div></td></tr>
</form>
|
 |
 |
 |
 |
Date :
2010-06-04 12:59:28 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมก็เจอ ยังแก้ไม่ได้ งงมาก
|
 |
 |
 |
 |
Date :
2010-09-12 13:44:13 |
By :
สุริยา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เซิร์ฟเวอร์ไม่ได้กำหนดชนิด mime เหมาะสมสำหรับ ms ใหม่ประเภทไฟล์
เพิ่มไปใน / etc / mime.types ไฟล์และ restart apache โดยเพิ่ม
# Added by myname 2009-06-03
application/vnd.ms-word.document.macroEnabled.12 docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.ms-powerpoint.template.macroEnabled.12 potm
application/vnd.openxmlformats-officedocument.presentationml.template potx
application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.ms-excel.addin.macroEnabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/vnd.ms-excel.template.macroEnabled.12 xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
ที่มา http://www.webdeveloper.com/forum/showthread.php?t=162526
|
 |
 |
 |
 |
Date :
2010-12-28 15:42:55 |
By :
Pocky |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปัญหามันมาจาก ตัวช่วย Download นะครับ ไม่น่าจะเกี่ยวกับ code
คุณใช้อะไรโหลดหรอครับ IDM รึเปล่า
|
 |
 |
 |
 |
Date :
2010-12-28 17:17:41 |
By :
lightkung |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|