Nieuw lid |
|
Hallo,
Map staat in 777, was ik vergeten te vermelden, dus er is inderdaad iets anders mis.
Hier is het script:
<?php
error_reporting(E_ALL);
$map = "/domains/xs2web.be/public_html/"; // Map waar alles terecht komt
function upload_file($fTmp, $fNew) {
if(file_exists($fNew)) {
return false;
} else {
copy($fTmp, $fNew);
return true;
}
}
if(IsSet($_POST['submit'])) {
for($i = 0; $i < count($_FILES['bestand']['name']); $i++) {
if(IsSet($_FILES['bestand']['name'][$i]) && is_uploaded_file($_FILES['bestand']['tmp_name'][$i])) {
if(!upload_file($_FILES['bestand']['tmp_name'][$i], $map.$_FILES['bestand']['name'][$i])) {
$error = true;
}
}
}
if(IsSet($error)) {
echo "Er ging iets mis!";
} else {
echo "Het is gelukt!!";
}
} else {
if(IsSet($_POST['aantal'])) {
$aantal = $_POST['aantal'];
} else {
$aantal = 5;
}
?>
<form action="" method="post">
<input type="text" name="aantal" value="<?php echo $aantal; ?>" size="1"> <input type="submit" name="aantal_submit" value="Aantal bestanden">
</form>
<form action="" method="post" enctype="multipart/form-data">
<?php
for($i = 0; $i < $aantal; $i++) {
?>
Bestand <?php echo $i + 1; ?>:
<input name="bestand[<?php echo $i; ?>]" type="file" size="100">
<br>
<?php
}
?> <br><br>
<input type="submit" name="submit" value="Uploaden">
</form>
<?php
}
?>
</body>
</html>
<?php $map = "/domains/xs2web.be/public_html/"; // Map waar alles terecht komt function upload_file($fTmp, $fNew) { return false; } else { return true; } } if(IsSet($_POST['submit'])) { for($i = 0; $i < count($_FILES['bestand']['name']); $i++) { if(!upload_file($_FILES['bestand']['tmp_name'][$i], $map.$_FILES['bestand']['name'][$i])) { $error = true; } } } echo "Er ging iets mis!"; } else { } } else { if(IsSet($_POST['aantal'])) { $aantal = $_POST['aantal']; } else { $aantal = 5; } ?> <form action="" method="post"> <input type="text" name="aantal" value=" <?php echo $aantal; ?>" size="1"> <input type="submit" name="aantal_submit" value="Aantal bestanden"> </form> <form action="" method="post" enctype="multipart/form-data"> <?php for($i = 0; $i < $aantal; $i++) { ?> Bestand <?php echo $i + 1; ?>: <input name="bestand[ <?php echo $i; ?>]" type="file" size="100"> <br> <?php } ?> <br><br> <input type="submit" name="submit" value="Uploaden"> </form> <?php } ?> </body> </html>
|