Parašė robert· 2009 Lie. 22 19:07:13
#2
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 2000000000000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Gražinimo kodas: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "<b>Failo vardas</b>: " . $_FILES["file"]["name"] . "<br />";
echo "<b>Tipas</b>: " . $_FILES["file"]["type"] . "<br />";
echo "<b>Svoris</b>: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
if (file_exists("foto/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " Toks pavadinimas jau naudojamas. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"foto/" . $_FILES["file"]["name"]);
echo "<b>Nuoroda</b>: " . "http://puslapis.lt/foto/" . $_FILES["file"]["name"] . "<br />";
echo "<img src='http://puslapis.lt/foto/" . $_FILES["file"]["name"] . "' width='500' height='450'>";
}
}
}
else
{
echo "Klaida: failo įkelti nepavyko";
}
?>
Redagavo robert· 2009 Lie. 22 19:07:23