move_uploaded_file รูปไม่ได้ ลองมาหลายครั้งแล้วรูปไม่เข้าโฟล์เดอร์ที่ต้องการ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> +++ ตั้งคำถามในแต่ละกลุ่ม +++ </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<link href="style.css" rel="stylesheet" type="text/css" />
</HEAD>
<BODY>
<br>
<form action="faq_group.php" method="post" name=form1>
<center><a href="index.php">หน้าหลัก</a>\
<a href="faq_group_form.php">ตั้งชื่อกลุ่ม</a>\
<a href="question_form.php">ตั้งคำถาม</a>\
<a href=" faq_form.php">คำถามที่ถามบ่อย</a></center><hr size="1"><br>
<table width="75%" align="center" bordercolor="#999999" bgcolor="#999999">
<TR>
<TD><div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF">
<b>ตั้งคำถามในแต่ละกลุ่ม</b></font></div></TD>
</TR>
<tr>
<td bgcolor="#FFFFFF"><br>
<table width="95%" border="0" align="center">
<tr>
<td>
<?
// Prepare Variables
$q_name =$_REQUEST["q_name"];
$q_answer =$_REQUEST["q_answer"];
$q_date =date("Y-m-d");
//echo "<br>1=".
$new = explode("-",$q_date); //***14-08-51***
//print_r($new);
//echo "<br>1=".
$new2 = $new[2]."-".$new[1]."-".$new[0];
//exit;
$q_time =date("H:i:s");
$group_id =$_REQUEST["group_id"];
$pic =$_FILES["file"];
//$type =$_FILES["file"];
$pic_news ="pic/".$pic["name"];
if($pic["name"]==""){ // ***11-08-51***
echo $pic_news="";
}
$pic_type =$pic["type"];
$pic_size =$pic["size"];
$pic_temp =$pic["tmp_name"];
//echo $pic["name"]. "<br />";
echo $pic_news . "<br />";
echo $pic_type . "<br />";
echo $pic_size . "<br />";
echo $pic_temp . "<br />";
// Check Picture
if ($pic_size !=0 || $pic_size !="" ){
if ($pic_size>20000) {
echo "<center><font color=red>File Size Exceed</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
else if ($pic_type !="image/gif" && $pic_type !="image/pjpeg" && $pic_type !="image/png" && $pic_type !="image/bmp") {
echo "<center><font color=red>Invalid File Type</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
}
include("connect.php");
// Save Picture
//$dir= "C:/Inetpub/wwwrootfaq_web/pic";
//$images =$_FILES["file"]["tmp_name"] ;
//$Name=$_FILES['file']['name'];
//$test="$pic_news";
//copy($pic_temp,$pic_news);
//copy($pic_temp,"pic/".$pic_news);
/*เพิ่มเติมคับ นอกเหนือจาก $filename = $_FILES['yourfileuploadname'] ['name'] ;
สามารถทำได้อีกวิธีครับ >>> $filename = $youfileuploadname_name;
ใช้ได้เหมือนกันครับ */
//echo $pic_new = "pic/"."1".$pic_type;
move_uploaded_file($pic_news,$pic_temp);
//move_uploaded_file(ตำแหน่งไฟล์ที่ upload ขึ้นไป,ตำแหน่ง และ ชื่อ ไฟล์ ที่เราต้องการเก็บ )
// Add data
$sql = "INSERT INTO FAQ_QUESTION"
. " (q_id,q_name,q_answer,q_date,q_time,group_id,q_pic)"
. " VALUES('','$q_name','$q_answer','$new2','$q_time','$group_id','$pic_news')";
mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
echo "รูปที่ $id<br>";
echo $sql;
include("disconnect.php");
//echo "id = ".$id;
echo "<center><font color=red>บันทึกข้อมูลเรียบร้อยแล้ว</font></center>";
?>
</td>
</tr>
</table>
</td>
</tr>
<TR>
<TD bgcolor="#F0F0F0"><div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#F0F0F0">
<b>ชื่อกลุ่ม</b></font></div></TD>
</TR>
</table>
</form>
</BODY>
</HTML>
Tag : - - - -
Date :
18 ก.ย. 2551 17:27:19
By :
ดาว
View :
8563
Reply :
8
ยาวเกิน
Date :
18 ก.ย. 2551 22:32:19
By :
ngong
ตัดมาแค่นี้คงไม่ยาวเกินนะค่ะ
<?
// Prepare Variables
$q_name =$_REQUEST["q_name"];
$q_answer =$_REQUEST["q_answer"];
$q_date =date("Y-m-d");
//echo "<br>1=".
$new = explode("-",$q_date); //***14-08-51***
//print_r($new);
//echo "<br>1=".
$new2 = $new[2]."-".$new[1]."-".$new[0];
//exit;
$q_time =date("H:i:s");
$group_id =$_REQUEST["group_id"];
$pic =$_FILES["file"];
//$type =$_FILES["file"];
$pic_news ="pic/".$pic["name"];
if($pic["name"]==""){ // ***11-08-51***
echo $pic_news="";
}
$pic_type =$pic["type"];
$pic_size =$pic["size"];
$pic_temp =$pic["tmp_name"];
//echo $pic["name"]. "<br />";
echo $pic_news . "<br />";
echo $pic_type . "<br />";
echo $pic_size . "<br />";
echo $pic_temp . "<br />";
// Check Picture
if ($pic_size !=0 || $pic_size !="" ){
if ($pic_size>20000) {
echo "<center><font color=red>File Size Exceed</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
else if ($pic_type !="image/gif" && $pic_type !="image/pjpeg" && $pic_type !="image/png" && $pic_type !="image/bmp") {
echo "<center><font color=red>Invalid File Type</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
}
include("connect.php");
// Save Picture
//$dir= "C:/Inetpub/wwwrootfaq_web/pic";
//$images =$_FILES["file"]["tmp_name"] ;
//$Name=$_FILES['file']['name'];
//$test="$pic_news";
//copy($pic_temp,$pic_news);
//copy($pic_temp,"pic/".$pic_news);
/*เพิ่มเติมคับ นอกเหนือจาก $filename = $_FILES['yourfileuploadname'] ['name'] ;
สามารถทำได้อีกวิธีครับ >>> $filename = $youfileuploadname_name;
ใช้ได้เหมือนกันครับ */
//echo $pic_new = "pic/"."1".$pic_type;
move_uploaded_file($pic_news,$pic_temp);
//move_uploaded_file(ตำแหน่งไฟล์ที่ upload ขึ้นไป,ตำแหน่ง และ ชื่อ ไฟล์ ที่เราต้องการเก็บ )
// Add data
$sql = "INSERT INTO FAQ_QUESTION"
. " (q_id,q_name,q_answer,q_date,q_time,group_id,q_pic)"
. " VALUES('','$q_name','$q_answer','$new2','$q_time','$group_id','$pic_news')";
mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
echo "รูปที่ $id<br>";
echo $sql;
include("disconnect.php");
//echo "id = ".$id;
echo "<center><font color=red>บันทึกข้อมูลเรียบร้อยแล้ว</font></center>";
?>
Date :
19 ก.ย. 2551 09:21:32
By :
ดาว
ลองดูนะครับ
$dir='./pic/';
$pic_news = $dir.basename($pic["name"]);
//สร้างโฟลเดอร์ pic ไว้ที่เดียวกับที่ไฟล์นี้อยู่นะครับ
//เช่น ไฟล์นี้อยู่ที่ C:\Appserv\www\ เราก็สร้างโฟล์เดอร์ที่ C:\Appserv\www\ เหมือนกัน
// งง ยังไงก็ msn มาถามได้นะครับ หรือเมลล์มาได้
$pic_news ="./pic/".$pic["name"];
move_uploaded_file($pic_temp,$pic_news);
Date :
19 ก.ย. 2551 11:06:10
By :
pbboy100
กำ เมื่อกี๊ผิด เอาใหม่ ๆ
$dir='./pic/';
$pic_news = $dir.basename($pic["name"]);
move_uploaded_file($pic_temp,$pic_news);
อิอิ ลืมลบ $pic_news ="./pic/".$pic["name"]; ออกไป 5 55+
Date :
19 ก.ย. 2551 11:08:19
By :
pbboy100
มันขึ้น error
./pic/MOS_01S.jpg
image/pjpeg
5964
C:\PHP\temp\phpBFA.tmp
Warning: move_uploaded_file(./pic/MOS_01S.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\faq_web\question.php on line 104
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\temp\phpBFA.tmp' to './pic/MOS_01S.jpg' in C:\Inetpub\wwwroot\faq_web\question.php on line 104
รูปที่ 385
INSERT INTO FAQ_QUESTION (q_id,q_name,q_answer,q_date,q_time,group_id,q_pic) VALUES('','ghgh','ghgh','19-09-2008','12:35:14','6','./pic/MOS_01S.jpg')
โค้ดที่แก้แล้ว
<?
// Prepare Variables
$q_name =$_REQUEST["q_name"];
$q_answer =$_REQUEST["q_answer"];
$q_date =date("Y-m-d");
//echo "<br>1=".
$new = explode("-",$q_date); //***14-08-51***
//print_r($new);
//echo "<br>1=".
$new2 = $new[2]."-".$new[1]."-".$new[0];
//exit;
$q_time =date("H:i:s");
$group_id =$_REQUEST["group_id"];
$pic =$_FILES["file"];
//$type =$_FILES["file"];
//$pic_news ="pic/".$pic["name"];
$dir='./pic/';
$pic_news = $dir.basename($pic["name"]);
if($pic["name"]==""){ // ***11-08-51***
echo $pic_news="";
}
$pic_type =$pic["type"];
$pic_size =$pic["size"];
$pic_temp =$pic["tmp_name"];
//echo $pic["name"]. "<br />";
echo $pic_news . "<br />";
echo $pic_type . "<br />";
echo $pic_size . "<br />";
echo $pic_temp . "<br />";
// Check Picture
if ($pic_size !=0 || $pic_size !="" ){
if ($pic_size>20000) {
echo "<center><font color=red>File Size Exceed</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
else if ($pic_type !="image/gif" && $pic_type !="image/pjpeg" && $pic_type !="image/png" && $pic_type !="image/bmp") {
echo "<center><font color=red>Invalid File Type</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
}
include("connect.php");
// Save Picture
//$dir= "C:/Inetpub/wwwrootfaq_web/pic";
//$images =$_FILES["file"]["tmp_name"] ;
//$Name=$_FILES['file']['name'];
//$test="$pic_news";
//copy($pic_temp,$pic_news);
//copy($pic_temp,"pic/".$pic_news);
/*เพิ่มเติมคับ นอกเหนือจาก $filename = $_FILES['yourfileuploadname'] ['name'] ;
สามารถทำได้อีกวิธีครับ >>> $filename = $youfileuploadname_name;
ใช้ได้เหมือนกันครับ */
//echo $pic_new = "pic/"."1".$pic_type;
move_uploaded_file($pic_temp,$pic_news);
//move_uploaded_file($pic_news,$pic_temp);
//move_uploaded_file(ตำแหน่งไฟล์ที่ upload ขึ้นไป,ตำแหน่ง และ ชื่อ ไฟล์ ที่เราต้องการเก็บ )
// Add data
$sql = "INSERT INTO FAQ_QUESTION"
. " (q_id,q_name,q_answer,q_date,q_time,group_id,q_pic)"
. " VALUES('','$q_name','$q_answer','$new2','$q_time','$group_id','$pic_news')";
mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
echo "รูปที่ $id<br>";
echo $sql;
include("disconnect.php");
//echo "id = ".$id;
echo "<center><font color=red>บันทึกข้อมูลเรียบร้อยแล้ว</font></center>";
?>
Date :
19 ก.ย. 2551 11:37:38
By :
ดาว
ไม่ได้ง่ะ
<?
// Prepare Variables
$q_name =$_REQUEST["q_name"];
$q_answer =$_REQUEST["q_answer"];
$q_date =date("Y-m-d");
//echo "<br>1=".
$new = explode("-",$q_date); //***14-08-51***
//print_r($new);
//echo "<br>1=".
$new2 = $new[2]."-".$new[1]."-".$new[0];
//exit;
$q_time =date("H:i:s");
$group_id =$_REQUEST["group_id"];
$pic =$_FILES["file"];
//$type =$_FILES["file"];
//$pic_news ="pic/".$pic["name"];
$dir='./pic/';
$pic_news = $dir.basename($pic["name"]);
if($pic["name"]==""){ // ***11-08-51***
echo $pic_news="";
}
$pic_type =$pic["type"];
$pic_size =$pic["size"];
$pic_temp =$pic["tmp_name"];
//echo $pic["name"]. "<br />";
echo $pic_news . "<br />";
echo $pic_type . "<br />";
echo $pic_size . "<br />";
echo $pic_temp . "<br />";
// Check Picture
if ($pic_size !=0 || $pic_size !="" ){
if ($pic_size>20000) {
echo "<center><font color=red>File Size Exceed</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
else if ($pic_type !="image/gif" && $pic_type !="image/pjpeg" && $pic_type !="image/png" && $pic_type !="image/bmp") {
echo "<center><font color=red>Invalid File Type</font></center><br />";
echo "<center><a href='javascript:history.back();'>Back</a></center>";
return;
}
}
include("connect.php");
move_uploaded_file($pic_temp,$pic_news);
// Add data
$sql = "INSERT INTO FAQ_QUESTION"
. " (q_id,q_name,q_answer,q_date,q_time,group_id,q_pic)"
. " VALUES('','$q_name','$q_answer','$new2','$q_time','$group_id','$pic_news')";
mysql_query($sql) or die(mysql_error());
$id = mysql_insert_id();
echo "รูปที่ $id<br>";
echo $sql;
include("disconnect.php");
//echo "id = ".$id;
echo "<center><font color=red>บันทึกข้อมูลเรียบร้อยแล้ว</font></center>";
?>
Date :
19 ก.ย. 2551 11:58:41
By :
ดาว
เราก็เคยเป็นนะคับ
แก้ได้แล้วคับ
ถ้าอยากถามก็แอ็ดเมลลมาถามได้คับ
[email protected]
Date :
20 ก.ย. 2551 22:30:40
By :
เอี่ยว
ช่วยดูโค๊ดให้หน่อยมันไม่ส่งไฟล์ บน linux นะครับ
<?php
require_once("../Connections/conn.php");
require_once("../public/public_function.php");
//include("../connections/conn.php");
//include ("../public/public_function.php");
$table="tbcmactivity";
$table_image="tbcmactimage";
?>
<?php
if(isset($_POST["pic_edit_id"])){
$Picture_ID=$_POST["pic_edit_id"];
$Des = $_POST["detail"];
$act_id=$_GET["act_id"];
if(isset($_FILES["file"]["name"]) && $_FILES["file"]["name"]!= ""){
$Picture_Path = "$act_id";
del_one($Picture_Path."/".$Picture_ID);
del_one($Picture_Path."/small/".$Picture_ID);
//------------------------------------------------
//###################################################################################
//$image = @imagecreatefromjpeg($_FILES["picture$i"]["tmp_name"]) or die("no image");
//$resizeimage = @imagecreatetruecolor(50,50) or die("resize");
//imagecopyresized($resizeimage,$image,0,0,0,0,50,50,imagesx($image),imagesy($image));
//imagejpeg($resizeimage);
//imagedestroy($resizeimage);
//###################################################################################
$upload_path = "$Picture_Path"."/";
$file = $_FILES["file"]["name"];
$file_to_upload = "$Picture_Path"."/".$Picture_ID.".jpeg";
$file_to_upload_small = "$Picture_Path"."/small/".$Picture_ID.".jpeg";//###small image
$tmp_file = $_FILES["file"]["tmp_name"];
$size = getimagesize($tmp_file);
$img_width = $size[0];
$img_height = $size[1];
$img_type = $size[2];
if ($img_width<='400' && $img_height<='300')
{
//###small image
/*$imgs = @imagecreatefromjpeg($tmp_file);
$ims = @imagecreatetruecolor ( imagesx($imgs)*120/imagesy($imgs),120) or die ("Cannot Initialize new GD image stream");
@imagecopyresized($ims, $imgs, 0, 0, 0, 0, imagesx($imgs)*120/imagesy($imgs),120,imagesx($imgs),imagesy($imgs));
@imagejpeg ($ims,$file_to_upload_small);
@imagedestroy ($ims);
@move_uploaded_file($imgs,$file_to_upload_small);
*///###small image
$height=120;
$width=round($height*$img_width/$img_height );
$images_orig =imagecreatefromjpeg($tmp_file);
$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,$file_to_upload_small);
@move_uploaded_file($images_fin,$file_to_upload_small);
@move_uploaded_file($images_orig,$file_to_upload);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
}else{
//###small image
$height=120;
$width=round($height*$img_width/$img_height );
$images_orig =imagecreatefromjpeg($tmp_file);
$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,$file_to_upload_small);
@move_uploaded_file($images_fin,$file_to_upload_small);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
/*$imgs = @imagecreatefromjpeg($tmp_file);
$ims = @imagecreatetruecolor ( imagesx($imgs)*120/imagesy($imgs),120) or die ("Cannot Initialize new GD image stream");
@imagecopyresized($ims, $imgs, 0, 0, 0, 0, imagesx($imgs)*120/imagesy($imgs),120,imagesx($imgs),imagesy($imgs));
@imagejpeg ($ims,$file_to_upload_small);
@imagedestroy ($ims);
@move_uploaded_file($imgs,$file_to_upload_small);*/
//###small image
//# Create a temporary resource file.
$img = @imagecreatefromjpeg($tmp_file);
//# Create a new image with specified size
$im = @imagecreatetruecolor ( imagesx($img)*300/imagesy($img),300) or die ("Cannot Initialize new GD image stream");
//# Resize original image into new specified dimensions
imagecopyresized($im, $img, 0, 0, 0, 0, imagesx($img)*300/imagesy($img),300,imagesx($img),imagesy($img));
imagejpeg ($im,$file_to_upload);
@move_uploaded_file($im,$file_to_upload_small);
imagedestroy ($im);
//print("incorrect<br>");
} //end if size limit
}//end if(isset($_FILES["file"]["name"]) && $_FILES["file"]["name"]!= "")
//------------------------------------------------
$sql1="UPDATE $table_image SET `detail` = '$Des' WHERE `picture_id` ='".$Picture_ID."'";
mysql_query($sql1)or die(mysql_error());
}else{
$act_id = $_GET["act_id"];
if(@mkdir("$act_id",0755)){
if(@mkdir("$act_id/small",0755)){
}else{
}
}else{
if(@mkdir("$act_id/small",0755)){
}else{
}
}
//$Progress_Report_ID = $_GET["activity_report_id"];
//for($i = 0;$i<5;$i++){
$Picture_ID = AutoID_ActImage($act_id);
//$Picture_Name = $Picture_ID;
$Description = $_POST["detail"];
$Picture_Path = "$act_id";
if (isset($_FILES["file"]["name"]) && $_FILES["file"]["name"]!= ""){
//###################################################################################
//$image = @imagecreatefromjpeg($_FILES["picture$i"]["tmp_name"]) or die("no image");
//$resizeimage = @imagecreatetruecolor(50,50) or die("resize");
//imagecopyresized($resizeimage,$image,0,0,0,0,50,50,imagesx($image),imagesy($image));
//imagejpeg($resizeimage);
//imagedestroy($resizeimage);
//###################################################################################
$upload_path = "$Picture_Path"."/";
$file = $_FILES["file"]["name"];
$file_to_upload = "$Picture_Path"."/".$Picture_ID.".jpeg";
$file_to_upload_small = "$Picture_Path"."/small/".$Picture_ID.".jpeg";//###small image
$tmp_file = $_FILES["file"]["tmp_name"];
$size = getimagesize($tmp_file);
$img_width = $size[0];
$img_height = $size[1];
$img_type = $size[2];
if ($img_width<='400' && $img_height<='300')
{
//###small image
/*$imgs = @imagecreatefromjpeg($tmp_file);
$ims = @imagecreatetruecolor ( imagesx($imgs)*120/imagesy($imgs),120) or die ("Cannot Initialize new GD image stream");
@imagecopyresized($ims, $imgs, 0, 0, 0, 0, imagesx($imgs)*120/imagesy($imgs),120,imagesx($imgs),imagesy($imgs));
@imagejpeg ($ims,$file_to_upload_small);
@imagedestroy ($ims);
@move_uploaded_file($imgs,$file_to_upload_small);*/
$height=120;
$width=round($height*$img_width/$img_height );
$images_orig =imagecreatefromjpeg($tmp_file);
$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,$file_to_upload_small);
@move_uploaded_file($images_fin,$file_to_upload_small);
//###small image
if((move_uploaded_file($tmp_file,$file_to_upload))){
$sql = "INSERT INTO $table_image (picture_id,act_id,detail)
VALUES('".$Picture_ID."','".$act_id."','".$Description."')";//ไม่ต้องการให้เก็บ ../
mysql_query($sql)or die(mysql_error());
}
ImageDestroy($images_orig);
ImageDestroy($images_fin);
}else{
//###small image
$height=120;
$width=round($height*$img_width/$img_height );
$images_orig =imagecreatefromjpeg($tmp_file);
$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,$file_to_upload_small);
@move_uploaded_file($images_fin,$file_to_upload_small);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
/*$imgs = @imagecreatefromjpeg($tmp_file);
$ims = @imagecreatetruecolor ( imagesx($imgs)*120/imagesy($imgs),120) or die ("Cannot Initialize new GD image stream");
@imagecopyresized($ims, $imgs, 0, 0, 0, 0, imagesx($imgs)*120/imagesy($imgs),120,imagesx($imgs),imagesy($imgs));
@imagejpeg ($ims,$file_to_upload_small);
@imagedestroy ($ims);
@move_uploaded_file($imgs,$file_to_upload_small);*/
//###small image
$height=300;
$width=round($height*$img_width/$img_height );
$images_orig =imagecreatefromjpeg($tmp_file);
$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,$file_to_upload);
//# Create a temporary resource file.
/*$img = @imagecreatefromjpeg($tmp_file);
//# Create a new image with specified size
$im = @imagecreatetruecolor ( imagesx($imgs)*300/imagesy($imgs),300) or die ("Cannot Initialize new GD image stream");
//# Resize original image into new specified dimensions
imagecopyresized($im, $img, 0, 0, 0, 0, imagesx($imgs)*300/imagesy($imgs),300,imagesx($img),imagesy($img));
imagejpeg ($im,$file_to_upload);
imagedestroy ($im);
//move_uploaded_file($img,$file_to_upload);*/
if(!(move_uploaded_file($images_fin,$file_to_upload))){//don't understand why !
$sql = "INSERT INTO $table_image (act_id,picture_id,detail) VALUES
('".$act_id."','".$Picture_ID."','".$Description."')";//ไม่ต้องการให้เก็บ ../
mysql_query($sql)or die(mysql_error());
}else{ }
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//print("incorrect<br>");
}//end if size limit
}else{
//print("No Value");
}//end if POST_FILE
//}//end for
//if(isset($_POST["checkbox"]) && $_POST["checkbox"] == true){
}
//$page_direction = "pre_image_upload.php?act_id=$act_id";
//header("LOCATION:$page_direction");
?>
<meta http-equiv="refresh" content="3;URL=pre_image_upload.php?act_id=<?=$act_id;?>">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
Date :
2009-04-27 10:23:08
By :
wittawat
Load balance : Server 00