Uploadujem subory na server pomocou jednicuchecho skriptu :
<form enctype="multipart/form-data" action="" method="post">
<input type="hidden" />
Súbor: <input name="userfile" type="file" />
<input type="submit" value="Odošli" />
</form>
<?
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {print "Prenos uspesny";}
?>
Chcem poprosit o radu, ako urobit tak, aby pri jednej poziadavke na upload, sa vykonalo to, aby okrem toho, ze sa subor uploadne na dane miesto, aby sa uploadol zaroven aj na ine (do ineho adresara).
Skusal som nieco nasledovne, ale neslo to:
<form enctype="multipart/form-data" action="" method="post">
<input type="hidden" />
Súbor: <input name="userfile" type="file" />
<input type="submit" value="Odošli" />
</form>
<?
$uploaddir = 'uploads/';
$uploaddir2 = 'uploads2/';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {print "Prenos uspesny";}
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile2)) {print "Prenos uspesny2";}
?>
Poradite mi? Vdaka!
$druhemiesto = move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile2);
a az potom davaj overovacie podmienky :))
$uploadfile2 = $uploaddir2.$_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
copy($uploadfile, $uploadfile2);
print "Prenos uspesny";
}