|
|
|
ช่วยหน่อยค่ะ รูปที่อัพโหลดในโฟลเดอร์ ชื่อรูปเพี้ยนค่ะ ไม่เป็นภาษาไทย |
|
|
|
|
|
|
|
โค้ดอัพโหลดค่ะ
Code (PHP)
<?php
if(trim($_FILES["fileUpload"]["tmp_name"]) != "")
{
$images = $_FILES["fileUpload"]["tmp_name"];
$new_images = "Thumbnails_".$_FILES["fileUpload"]["name"];
copy($_FILES["fileUpload"]["tmp_name"],"trip_img/".$_FILES["fileUpload"]["name"]);
$width=300; //*** Fix Width & Heigh (Autu caculate) ***//
$size=GetimageSize($images);
$height=round($width*$size[1]/$size[0]);
$images_orig = ImageCreateFromJPEG($images);
$photoX = ImagesX($images_orig);
$photoY = ImagesY($images_orig);
$images_fin = ImageCreateTrueColor($width, $height);
ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
ImageJPEG($images_fin,"trip_img/".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);}
$tripid = $_POST['Trip_ID'];
$host="localhost"; //replace with your hostname
$username="root"; //replace with your username
$password=""; //replace with your password
$db_name="mytrips"; //replace with your database
//open connection to mysql db
$connection = mysqli_connect($host,$username,$password,$db_name) or die("Error " . mysqli_error($connection));
$sql = "INSERT INTO image(Image_Path, Trip_ID) VALUES('$new_images', '$tripid')";
mysqli_set_charset($connection,"utf8");
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
//$numrow=mysqli_num_rows($result);
if(($result)){
header("location:mng_trip_admin_img.php");
}else{
echo'cannot upload complete';
}
?>
|
|
|
|
|
Date :
2016-02-01 15:44:48 |
By :
narslins_mc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$upload_img_name = iconv("UTF-8", "TIS-620", $_FILES['file_upload']['name']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใช้ภาษาไทย ปัญหาจะตามมีอีกเยอะเลยครับ ทั้งการจัดเก็บและการนำไปใช้ในระยะยาวครับ แนะนำให้เปลี่ยนเป็นภาษาอังกฤษ
|
|
|
|
|
Date :
2016-02-02 09:14:51 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|