teşekkürler
kod:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include "../../include.php"; ?>
<?php
if(isset($_POST['submit']) ) {
$ad = $_POST['ad'];
$resim = $_POST['resim'];
$sql = "INSERT INTO urunler (ad, resim)
VALUES ('$ad','$resim')";
$result = mysql_query($sql);
echo 'Eklendi.';
echo '<meta http-equiv="refresh" content="2;url=ekle.php">';
}
else {
?>
<p align="center"><strong>Ürün Resmi:</strong></p>
<?php
if(!isset($_POST['gonder']) ) {
?>
<center>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" method="post">
Resim Seçin: <input type="file" name="resimler">
<input type="submit" name="gonder" value="Gönder">
</form>
<?php
}else{
if(is_uploaded_file($_FILES['resimler']['tmp_name']))
{
if(move_uploaded_file($_FILES['resimler']['tmp_name'],"../../urunler/".$_FILES['resimler']['name']))
{
$path="../../urunler/".$_FILES['resimler']['name']."";
echo "<center><b>".$path."</b> resmi eklendi.<br></center>\n";
}
else
{
echo "Hata oluştu.";
}
}
}
?>
</center>
</p>
<p align="center"><a href="index.php"><b>Kontrol Paneli</b></a></p>
</form>
<?php
}
?>
</HTML>