Merhaba
haberle beraber resim ekliyorum. çalişan klasor yonetim2'de, resim klasoru ise root'un altindaki haberimg klasoru. buraya resim yuklemek istiyorum.. bu hatayı aldım.
.. koydum yine olmadı. yardımcı olursanız memnun olurum.
Warning: move_uploaded_file(./haberimg/24.jpeg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/reklamve/public_html/yonetim2/haber_ykayit.php on line 40
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpx79Xlc' to './haberimg/24.jpeg' in /home/reklamve/public_html/yonetim2/haber_ykayit.php on line 40
dosya kayit edilemedi
haberle beraber resim ekliyorum. çalişan klasor yonetim2'de, resim klasoru ise root'un altindaki haberimg klasoru. buraya resim yuklemek istiyorum.. bu hatayı aldım.
.. koydum yine olmadı. yardımcı olursanız memnun olurum.
Warning: move_uploaded_file(./haberimg/24.jpeg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/reklamve/public_html/yonetim2/haber_ykayit.php on line 40
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpx79Xlc' to './haberimg/24.jpeg' in /home/reklamve/public_html/yonetim2/haber_ykayit.php on line 40
dosya kayit edilemedi
PHP:
<?
// echo getcwd();
$kaydet=$_POST['kaydet'];
$haber_baslik=$_POST['haber_baslik'];
$haber_yazi=$_POST['haber_yazi'];
$resim=$_POST['resim'];
$yazan=$_POST['yazan'];
$hit=$_POST['hit'];
if ($kaydet == 1)
{
if ($_FILES['resim']['type'] != "image/gif" &&
$_FILES['resim']['type'] != "image/jpeg" &&
$_FILES['resim']['type'] != "image/jpg" &&
$_FILES['resim']['type'] != "image/png")
{
echo "Dosya formatınız yanlış";
} else {
if($_FILES['resim']['type'] == "image/gif") $uzanti=".gif";
else if($_FILES['resim']['type'] == "image/jpeg") $uzanti=".jpeg";
else if($_FILES['resim']['type'] == "image/jpg") $uzanti=".jpg";
else if($_FILES['resim']['type'] == "image/png") $uzanti=".png";
if ($_FILES['resim']['size'] < 1024000) {
include 'yol.php';
$tarih = date("Y-m-d");
$yaz = mysql_query("INSERT INTO haber(haber_baslik, haber_yazi, resim, yazan, hit) VALUES('$haber_baslik','$haber_yazi','$resim','$yazan','$hit')");
$haber_id=mysql_insert_id();
print mysql_error();
$resim_adi=$haber_id.$uzanti;
//$resim_url1 = "haberimg/".$resim_adi;
$url1 = "/home/reklamve/public_html";
$resim_url1 = "./haberimg/".$resim_adi;
if (move_uploaded_file($_FILES['resim']['tmp_name'], $resim_url1)) {
echo "Dosya Kayit Edildi.\n";
$yaz=mysql_query("UPDATE haber SET resim='$resim_url1' WHERE haber_id=$haber_id");
}
else echo "dosya kayit edilemedi";
} else {
$boyut = $_FILES['resim']['size'];
$dosyamb = ($boyut / 1024) / 1024; // kb için bir 1024 ü sil
$mb = substr($dosyamb,0,4);
$hata1 = "Maks. dosya boyutu 1 MB. Sizin dosyanız: ".$mb." MB";
}
}
?>
<br><br> <a href="haber_ykayit.php" style="font-size: 12px; font-family: Verdana; color: Navy; background-color: #FFD1A8;"> Geri Dön </a>
<a href="#" onClick="javascript:window.close();" style="font-size: 12px; font-family: Verdana; color: Navy; background-color: #FFD1A8;"> Kapat </a><br><br>
<?
}
else
{
?>
<table border="0" align="CENTER" bgcolor="#FDE1A8">
<th colspan="2" align="CENTER" bgcolor="#0070DF"><font face="" color="White">Haber Girisi</font></th>
<tr>
<td align="LEFT">
<form action="haber_ykayit.php" method="post" enctype="multipart/form-data" name="habergir">
<input type=hidden name="MAX_FILE_SIZE" value=1000000">
Başlık : <input name="haber_baslik" type="text" size="25"><br>
Resim : <input name="resim" type="file" size="25"><br>
Yazan : <input name="yazan" type="text" size="25"><br>
<br><br><br><br>
<td align="RIGHT">
Haber Metni : <textarea name="haber_yazi" cols="30" rows="7"></textarea><br>
<input type="hidden" name="kaydet" value="1" />
<input name="Submit" type="submit" value="Gönder" />
</form>
</tr></table>
<?
}
?>