คือจะทำอัพโหลดไฟล์ .swf กับ .jpg ในฝั่งของ admin ลงฐานข้อมูล แล้วดึกไฟล์นั้นขึ้นมาโชว์ที่หน้า user อ่ะคะ ตอนนี้สามารถอัพไฟล์ ลงฐานข้อมูลได้แล้ว แต่ยังไม่สามารถโชว์ได้คะ ช่วยหน่อยนะคะ ขอบคุณค่ะ
Code
<?
include('connect.php');
$a_id = $_POST['a_id'];
$numPhoto = sizeof($_FILES['gallery']);
for($i=0;$i<$numPhoto;++$i){
if(trim($_FILES['gallery']['name'][$i]) != ''){
$sql = "INSERT INTO `gallery` (
`gall_id` ,
`a_id`
)
VALUES (
NULL , '$a_id');
";
mysql_query($sql);
$id = mysql_insert_id();
$pathinfo =pathinfo($_FILES['gallery']['name'][$i]);
$ext = $pathinfo['extension'];
$photoName = 'pic_'.$id.'.'.$ext;
$images = $_FILES["gallery"]["tmp_name"][$i];
$new_images = $photoName;
$width=600; //*** Fix Width & Heigh (Autu caculate) ***//
$size=GetimageSize($images);
$height=round($width*$size[1]/$size[0]);
$images_orig = ImageCreateFromJPEG($images);
//$pattern="\.(gif|jpg|jpeg|png|bmp|swf)$";
$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,"pic/".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
mysql_query('UPDATE gallery SET gall_name = "'.$photoName.'" WHERE gall_id = '.$id);
}
}
header('Location:admin_gallery_2.php?id='.$a_id);
?>
Code
<?
include('connect.php');
$textpic = $_POST['textpic'];
$sql = "INSERT INTO `album` (
`a_id` ,
`a_subject`
)
VALUES (
NULL , '$textpic'
);";
mysql_query($sql);
$id = mysql_insert_id();
header('Location:admin_Gallery.php?a_id='.$id);
?>
Code
[code]<?
//session_start();
include('connect.php');
$sql = "select * from album ORDER BY a_id desc";
$result = mysql_query($sql);
?>
<?
$i = 0;
while($row = mysql_fetch_assoc($result)){
?>
<th scope="col"><div align="left"><span class="style1">
<a href="gallery.php?id=<? echo $row['a_id']; ?>"><? echo $row['a_subject']; ?></a></span></div></th>
</tr>
<?
++$i;
}
?>
</table></th>
<th width="728" align="left" valign="top" scope="row"><table width="723" height="217" border="0" cellpadding="0" cellspacing="0">
<tr>
<th height="110" bgcolor="#FFFFFF" scope="col">
<div align="left">
<?
$i = 0;
while($row = mysql_fetch_assoc($result)){
$sql = 'SELECT gall_name FROM `gallery` WHERE a_id ='.$row['a_id'];
$resultPho = mysql_query($sql);
$rowPho = mysql_fetch_assoc($resultPho);
?>
<img src= "<? echo $rowPho['gall_name']; ?>" width="200" border="5" style="border:#ffffff 4px solid;" /></a> </div>
</a></th>
<?
++$i;
}
?>
</tr>
</table></th>
[/code]
Tag : - - - -