PHP ver gevorderde |
|
Ik gebruik dit :
<?php
error_reporting(E_ALL);
$map = "foto/"; // Map waar alles geupload wordt
if(IsSet($_POST['submit'])) {
$selectl = mysql_query("SELECT * FROM `fotos_foto` ORDER BY `id`DESC LIMIT 1");
$aantall = mysql_num_rows($selectl);
if($aantall > 0) {
$objl = mysql_fetch_assoc($selectl);
$aantalll = $objl['id'];
} else {
$aantalll = 1;
}
for($i = 0; $i < count($_FILES['bestand']['name']); $i++) {
if(!move_uploaded_file($_FILES['bestand']['name'][$i],$map.$_FILES['bestand'][$aantalll]))
{
echo "Fout";
} else {
mysql_query("INSERT INTO `fotos_foto` (ida) VALUES ('". $_POST['album'] ."')") or die (Mysql_Error());
echo "Bestand ". $i ." : Gelukt!<br>";
}
}
}
if(IsSet($_POST['aantal'])) {
$aantal = $_POST['aantal'];
} else {
$aantal = 5;
}
$select = mysql_query("SELECT * FROM `fotos_albums`") or die (Mysql_Error());
$aantal2 = mysql_num_rows($select);
if($aantal2 == 0) {
echo "<b>Maak eerst een album aan!<b>";
} else {
?>
<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>
<br><br>
<form action="" method="post" enctype="multipart/form-data">
<select size="1" name="album">
<?php
while($obj = mysql_fetch_assoc($select)) {
echo "<option value='". $obj['id'] ."'>". $obj['naam'] ."</option>";
}
echo "</select><br>";
for($i = 0; $i < $aantal; $i++) {
?>
Bestand <?php echo $i + 1; ?>: <input type="file" name="bestand[<?php echo $i; ?>]"><br>
<?php
}
?>
<input type="submit" name="submit" value="Uploaden">
</form>
<?php
}
?>
<?php $map = "foto/"; // Map waar alles geupload wordt if(IsSet($_POST['submit'])) { $selectl = mysql_query("SELECT * FROM `fotos_foto` ORDER BY `id`DESC LIMIT 1"); if($aantall > 0) { $aantalll = $objl['id']; } else { $aantalll = 1; } for($i = 0; $i < count($_FILES['bestand']['name']); $i++) { if(!move_uploaded_file($_FILES['bestand']['name'][$i],$map.$_FILES['bestand'][$aantalll])) { } else { echo "Bestand ". $i ." : Gelukt!<br>"; } } } if(IsSet($_POST['aantal'])) { $aantal = $_POST['aantal']; } else { $aantal = 5; } if($aantal2 == 0) { echo "<b>Maak eerst een album aan!<b>"; } else { ?> <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> <br><br> <form action="" method="post" enctype="multipart/form-data"> <select size="1" name="album"> <?php echo "<option value='". $obj['id'] ."'>". $obj['naam'] ."</option>"; } for($i = 0; $i < $aantal; $i++) { ?> Bestand <?php echo $i + 1; ?>: <input type="file" name="bestand[ <?php echo $i; ?>]"><br> <?php } ?> <input type="submit" name="submit" value="Uploaden"> </form> <?php } ?>
De map foto heeft de 777 rechten. Maar krijg dus fouten ala :
Citaat: Notice: Undefined index: 3 in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(foto/): failed to open stream: Is a directory in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(): Unable to move '/tmp/phpvvAbBW' to 'foto/' in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Fout
Notice: Undefined index: 3 in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(foto/): failed to open stream: Is a directory in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(): Unable to move '/tmp/phpRiUmKC' to 'foto/' in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Fout
Notice: Undefined index: 3 in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(foto/): failed to open stream: Is a directory in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Warning: move_uploaded_file(): Unable to move '/tmp/phprzHXFh' to 'foto/' in /home/partykick/domains/partykick.nl/public_html/admin.php on line 205
Fout
Lijn 205 ==
<?php
if(!move_uploaded_file($_FILES['bestand']['name'][$i],$map.$_FILES['bestand'][$aantalll]))
?>
<?php if(!move_uploaded_file($_FILES['bestand']['name'][$i],$map.$_FILES['bestand'][$aantalll])) ?>
|