Cod: Selectaţi tot
<?php
if(isset($_POST['submit']))
{
$uploadpath = "../../cantari/diverse/"; // Directorul unde incarca pozele
$id=$_POST['id'];
$denumire=$_POST['denumire'];
$marime=$_POST['marime'];
$data=$_POST['data'];
$descarca=$uploadpath. basename( $_FILES['descarca']['name']);
if(strlen($denumire)<1)
{
print "Nu este nici o cantare!";
}
else
{
if(move_uploaded_file($_FILES['poza']['tmp_name'], $poza)) {
echo "Cantarea:<b> ". basename( $_FILES['descarca']['name']). "</b> a fost incarcat cu succes.";
}
$addemail="Insert into cantari_rosii(denumire, marime, data, descarca) values('$denumire', '$marime', '$data', '$descarca')";
mysql_query($addemail) or die("NU se poate adauga!");
print "<br>Cantarea adaugata! <a href='adaugare.php'>Inapoi la adaugare!</a>";
}
}
else
{
print "<form action='adaugare.php' method='post' enctype='multipart/form-data'>";
print "Denumire:<br>";
print "<input type='text' name='denumire' size='30'><br>";
print "Marime:<br>";
print "<input type='text' name='marime' size='30'><br>";
print "Data adaugarii:<br>";
print "<input type='text' name='data' id='data' size='30'><br>";
print "Cantare:<br>";
print "<input type='file' name='descarca'><br>";
print "<input type='submit' name='submit' value='Adauga cantare'></form>";
}
?>
Cod: Selectaţi tot
echo "<br />Marime (<i>in Bytes</i>): <b>". $_FILES['fisiere']['size'] ."</b><br /><br />";