<form action="upload2.php" method="post"
enctype="multipart/form-data">
<label for="file"></label>
<div align="center">
<table width="363">
<tr>
<td width="80" bgcolor="#CCCCCC"><label for="label">File*</label></td>
<td width="267" bgcolor="#CCCCCC"><input type="file" name="file" id="file" /></td>
</tr>
<tr>
<td bgcolor="#999999">Ket</td>
<td bgcolor="#999999"><label>
<input name="ket" type="text" id="ket" size="30">
</label></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">gamber ke </td>
<td bgcolor="#CCCCCC"><label>
<select name="ke" id="ke">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</label></td>
</tr>
</table>
<br />
<input type="submit" name="submit" value="Submit" />
</div>
</form>
upload2.php
<html><style type="text/css">
<!--
.style2 {font-size: 24px;
font-weight: bold;
}
-->
</style>
<body>
<div align="center">
<p><span class="style2">Edit Harga GAMBAR </span></p>
<p>
<?php
if ((($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"../images/" . "rumah" . "$_POST[ke]" . ".jpg");
echo "Stored in: " . "../images/" . "rumah" . "$_POST[ke]" . ".jpg";
}
}
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tes", $con);
mysql_query("UPDATE data SET value = '$_POST[ket]'". "WHERE id = $_POST[ke]+14");
echo "<br>Data Telah Tersimpan";
mysql_close($con);
}
else
{
echo "Invalid file";
}
?>
</p>
</div>
</body>
</html>
Tidak ada komentar:
Posting Komentar