HTML beginner |
|
Ik ben aan het proberen heel simpel avatars up te loaden.
Maar wanneer ik dit doe, en een file selecteerd, geraakt hij niet voorbij: 'if(is_uploaded_file($_FILES['n_avatar']['tmp_name']))'
if(isset($_POST['avatar_veranderen']) ) {
if($n_avatar != '') {
$filename = $_FILES['n_avatar']['tmp_name'];
echo $filename;
echo $n_avatar;
if(is_uploaded_file($_FILES['n_avatar']['tmp_name'])) {
/*$ext = substr($_FILES['n_avatar']['name'], -4);
$filename = $_COOKIE['status'] . $ext;
move_uploaded_file($_FILES['n_avatar']['tmp_name'], "c:/apache/htdocs/project/avatars/" . $filename);
/*$query = "UPDATE leerlingen SET avatar = '" . $filename . "' WHERE id = " . $_GET['id'];
mysql_query($query) or die (mysql_error());*/
echo 'yes';
}
else {
echo '<h6>Fout.';
echo '<br>U kan <a href="javascript:history.go(-1)">hier</a> terugkeren naar de vorige pagina.</h6>';
}
}
else {
echo '<h6>U moet wel een avatar selecteren!';
echo '<br>U kan <a href="javascript:history.go(-1)">hier</a> terugkeren naar de vorige pagina.</h6>';
}
}
else {
$result = mysql_query("SELECT avatar FROM leerlingen WHERE id = " . $_GET['id']) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo '<br /><form action="?page=klas&action=avatar_wijzigen&id=' . $_GET['id'] . '" method="post">';
echo '<table border="0" cellspacing="0" cellpadding="0"><tr>';
echo '<td><img src="avatars/' . $row['avatar'] . '" class="mooi" style="margin: 0;" /></td><td style="width: 20px;"></td>';
echo '<td valign="top"><input type="file" name="n_avatar" size="50" style="margin-top: 3px;"><br />';
echo '<ul style="float: left; margin: 0; padding-left: 20px; list-style-image: url(\'images/knop.gif\');">';
echo '<li><h6 style="margin: 0; padding: 0;">De avatar mag maximaal 20kb zijn</h6></li>';
echo '<li><h6 style="margin: 0; padding: 0;">De lengte en breedte mogen maximaal 100px bedragen</h6></li>';
echo '</ul>';
echo '<input type="submit" name="avatar_veranderen" value="Avatar veranderen" class="kalender_veld">';
echo '</td></tr></table></form>';
}
}
if(isset($_POST['avatar_veranderen']) ) { if($n_avatar != '') { $filename = $_FILES['n_avatar']['tmp_name']; /*$ext = substr($_FILES['n_avatar']['name'], -4); $filename = $_COOKIE['status'] . $ext; move_uploaded_file($_FILES['n_avatar']['tmp_name'], "c:/apache/htdocs/project/avatars/" . $filename); /*$query = "UPDATE leerlingen SET avatar = '" . $filename . "' WHERE id = " . $_GET['id']; mysql_query($query) or die (mysql_error());*/ } else { echo '<br>U kan <a href="javascript:history.go(-1)">hier</a> terugkeren naar de vorige pagina.</h6>'; } } else { echo '<h6>U moet wel een avatar selecteren!'; echo '<br>U kan <a href="javascript:history.go(-1)">hier</a> terugkeren naar de vorige pagina.</h6>'; } } else { echo '<br /><form action="?page=klas&action=avatar_wijzigen&id=' . $_GET['id'] . '" method="post">'; echo '<table border="0" cellspacing="0" cellpadding="0"><tr>'; echo '<td><img src="avatars/' . $row['avatar'] . '" class="mooi" style="margin: 0;" /></td><td style="width: 20px;"></td>'; echo '<td valign="top"><input type="file" name="n_avatar" size="50" style="margin-top: 3px;"><br />'; echo '<ul style="float: left; margin: 0; padding-left: 20px; list-style-image: url(\'images /knop .gif\ ');">'; echo '<li><h6 style="margin: 0; padding: 0;">De avatar mag maximaal 20kb zijn</h6></li>'; echo '<li><h6 style="margin: 0; padding: 0;">De lengte en breedte mogen maximaal 100px bedragen</h6></li>'; echo '<input type="submit" name="avatar_veranderen" value="Avatar veranderen" class="kalender_veld">'; echo '</td></tr></table></form>'; } }
Ziet iemand hier soms een fout?
Alvast bedankt,
AcId - BuRn
|