|
|
|
ใช้ฟังก์ชั่น function.move-uploaded-file] แล้วรูปไม่ถูกเก็บเข้า folder ค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<table width="500" cellspacing="5" cellpadding="1" style="border:1px #ccc solid">
<tr>
<td class="forTableBgLeft" width="200">Edit Picture <?echo $i; ?>:</td>
<td width="300" class="forTableBgRight">
<?php if($row_rsRead["photo"] != "") {?>
<img src="../../uploads/<?php echo $row_rsRead["photo"] ?>" width="50" height="50">
<?php } else {?>
<img src="../../uploads/nophoto.jpg" width="75" height="75">
<?php }?>
<br />
<input type="file" id="fileUpload" name="fileUpload" />
<input name="btnSubmit" type="submit" value="Update" class="forButton">
</td>
</tr>
</table>
|
|
|
|
|
Date :
2011-12-16 09:03:37 |
By :
แก้ว |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<form name="form1" method="post" action="" enctype="multipart/form-data">
ใส่แล้วค่ะ แต่เหมือนเดิม รูปไม่เข้าค่ะ
|
|
|
|
|
Date :
2011-12-16 09:26:12 |
By :
แก้ว |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$id = $_GET["id"];
$prop_id = $_GET["prop_id"];
$fileUpload = $_POST["fileUpload"];
if($fileUpload != '')
{
if(move_uploaded_file($fileUpload,"../../uploads/".$fileUpload))
{
echo "Copy/Upload Complete<br>";
//*** UPDATE Record ***//
$strSQL = "UPDATE picture";
$strSQL .=" SET photo = '".$fileUpload."' WHERE photo_id = '".$id."' ";
$objQuery = mysql_query($strSQL);
echo "UPDATE picture SET photo = '".$fileUpload."' WHERE photo_id = '".$id."' ";
}
}
Code (PHP)
<form name="form2" method="post" action="" enctype="multipart/form-data">
<table width="720" border="0" align="center" cellpadding="1" cellspacing="1">
<?php do { ?>
<tr valign="top">
<td width="121" bgcolor="#F3F3F3" class="forTableBgLeft">Reference no.:</td>
<td bgcolor="#F8F8F8" class="forTableBgRight"><? echo $row_rsRead["prop_ref"];?></td>
<td width="136" bgcolor="#F3F3F3" class="forTableBgLeft">Property Name:</td>
<td width="182" bgcolor="#F8F8F8" class="forTableBgRight"><? echo $row_rsRead["prop_name"];?></td>
</tr>
<tr>
<td colspan="4" class="forTableBgLeft">
<?
$sql = "SELECT * FROM picture where prop_id = ".$row_rsRead['prop_id'];
$row = mysql_query($sql) or die ("Error Query [".$sql."]");
while($result = mysql_fetch_array($row))
{
?>
<img src="../../uploads/<?php echo $result["photo"]; ?>" width="75" height="75">
<? }
$strSQL = "SELECT * FROM picture where prop_id = ".$row_rsRead['prop_id']." and photo_id = ".$id;
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table cellspacing="2" cellpadding="2" ><tr>
<?
$i = 0;
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
$intRows++;
echo "<td>";
?>
<table width="500" cellspacing="5" cellpadding="1" style="border:1px #ccc solid">
<tr>
<td class="forTableBgLeft" width="200">Edit Picture <?echo $i; ?>:</td>
<td width="300" class="forTableBgRight">
<?php if($row_rsRead["photo"] != "") {?>
<img src="../../uploads/<?php echo $row_rsRead["photo"] ?>" width="50" height="50">
<?php } else {?>
<img src="../../uploads/nophoto.jpg" width="75" height="75">
<?php }?>
<br />
<input type="file" id="fileUpload" name="fileUpload" />
<input name="btnSubmit" type="submit" value="Update" class="forButton">
</td>
</tr>
</table>
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
else
{
echo "<td>";
}
}
echo"</tr></table>";
?>
</td><tr>
<tr>
<td bgcolor="#F8F8F8" class="forTableBgLeft" colspan="4" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td align="center"><input type="hidden" name="action" value="submitted" />
<input type="hidden" name="id" value="<? echo $row_rsRead['photo_id']; ?>" /></td>
</tr>
</table></td>
</tr>
<!-- generate admin features-->
<!-- end-->
<tr valign="top">
<td colspan="4" align="center"><br /><table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="../images/dot.gif"><img src="../images/dot.gif" width="3" height="5"></td>
</tr>
</table><br /></td>
</tr>
<?php } while ($row_rsRead = mysql_fetch_assoc($rsRead)); ?>
</table>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="middle" class="Header_Footer_bg">
<td width="33%" height="20">
<?php if ($pageNum_rsRead > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsRead=%d%s", $currentPage, max(0, $pageNum_rsRead - 1), $queryString_rsRead); ?>">Previous Page</a>
<?php } // Show if not first page ?></td>
<td width="33%" align="center"> </td>
<td width="33%" align="right"><?php if ($pageNum_rsRead < $totalPages_rsRead) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsRead=%d%s", $currentPage, min($totalPages_rsRead, $pageNum_rsRead + 1), $queryString_rsRead); ?>">Next Page</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
<table width="498" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td align="center"><table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="../images/dot.gif"><img src="../images/dot.gif" width="3" height="5" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
code ทั้งหมดค่ะ
|
|
|
|
|
Date :
2011-12-16 09:30:10 |
By :
แก้ว |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เวลา MOVE เราเอาใช้ตัวแปร $_FILES ไม่ไช่เหรอครับ?
|
|
|
|
|
Date :
2011-12-16 09:40:19 |
By :
ALTELMA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$id = $_GET["id"];
$prop_id = $_GET["prop_id"];
$fileUpload = $_POST["fileUpload"];
if($fileUpload != '')
{
if(move_uploaded_file($_FILES["fileUpload"]["tmp_name"],"../../uploads/".$_FILES["fileUpload"]["name"]))
{
echo "Copy/Upload Complete<br>";
//*** UPDATE Record ***//
$strSQL = "UPDATE picture";
$strSQL .=" SET photo = '".$fileUpload."' WHERE photo_id = '".$id."' ";
$objQuery = mysql_query($strSQL);
echo "UPDATE picture SET photo = '".$fileUpload."' WHERE photo_id = '".$id."' ";
}
}
อย่างนี้หรอค่ะ ถ้าเป็นอย่างอ่าค่ะ มันจะไม่เข้า move เลยอ่าค่ะ
|
|
|
|
|
Date :
2011-12-16 10:00:45 |
By :
แก้ว |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|