Merhaba, yönetim paneli yazarken bir yerde takıldım.
Panelde ekleme resim bölümü var. Resimi link ve upload yoluyla eklettiriyorum.
<p><strong>Resim: </strong> </p>
<p>
<table align="center" border="0" width="400">
<tr><td><input type="radio" id="alan_secim" name="alan_secim" onClick="GG('alan01')" />Resim Linkini girerek resim yükle.</td></tr>
<tr id="alan01" style="display: none;"><td><input name="resim" type="text" id="user" value="" size="35"></td></tr>
<tr><td><input type="radio" id="alan_secim" name="alan_secim" onClick="GG('alan02')" />Bilgisayardan Resim Yükle</td></tr>
<tr id="alan02" style="display: none;"><td>
<!--Resim upload-->
<? require_once("resimupload.php"); ?>
<!--Bitti Resim upload--></td></tr>
</table>Radio buton seçimine göre upload yada resim link textboxu geliyor. ama
resimupload.phpyi include ettiğimde altındaki yazılar vs. yüklenmiyor.
Sorun neden kaynaklanıyor olabilir?
resimupload.php dosyası kodları:
<form enctype="multipart/form-data" action="resimupload.php" method="post">
Select Image: <input type="file" name="userfile">
<input type="submit" value="Upload!">
</form>
<?php
$path = "images/"; //Tüm Hakları Saklıdır...
$max_size = "200000"; // Resmin Max. Boyutu için
$filename = $_POST['userfile'];
if (!isset($HTTP_POST_FILES['userfile'])) exit;
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
if ($HTTP_POST_FILES['userfile']['size']>$max_size) {
echo "The File is Too Big. The Max File Size is $max_size KB<br>n";
exit;
}
if (
($HTTP_POST_FILES['userfile']['type']=="image/gif") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpg") ||
($HTTP_POST_FILES['userfile']['type']=="image/bmp") ||
($HTTP_POST_FILES['userfile']['type']=="image/png") ||
($HTTP_POST_FILES['userfile']['type']=="image/jpeg")
)
{
if (file_exists($path . $HTTP_POST_FILES['userfile']['name']))
{
echo "A File With That Name Already Exists!<br>";
exit;
}
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);
if (!$res){
echo "Upload Failed!<br>";
exit;
}
else{
echo "Upload Sucessful!<br>";
}
echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>";
echo "<a href=$path".$HTTP_POST_FILES['userfile']['name'].">View Image</a>";
}
else
{
echo "Wrong File Type<br>";
exit;
}
}
?>