Ik probeer een uploader te maken met PHP, zodat ik makkelijk files op mijn host kan dumpen.
Echter, de uploader werkt niet.
Kunnen jullie zien wat er mis is?
Ik heb 2 pagina's, 1 met de form, en 1 die het bestand uploadt.
De 2 bestanden én de map waarin wordt geupload zijn allebei 777 gechmod.
Dit zijn de pagina's:
(NOTE: Ik heb het wachtwoord script en het upload script enzo allemaal ergens van internet geplukt, ik ben niet zo goed met PHP.
<head>
<meta http-equiv="Content-Language" content="nl">
<title>File Uploader</title>
<meta http-equiv="Robots" name="Robots" content="noindex, nofollow" /> <!-- Functie die ervoor zorgt dat de pagina wordt geopend als de bezoeker het juiste wachtwoord geeft -->
<script language="Javacript" type="text/javascript">
<!--Hide from non-JavaScript Browsers
function correct()
{
document.write("<html><head><title>File Uploader</title></head><body bgcolor='#ffffff'><center><p><font face='Century Gothic'>File Uploader<br>Klik op bladeren om het bestand te zoeken,<br>en klik daarna op uploaden om je bestand te uploaden.<br><br><br></font></p><form action='uploadbestand.php' method='post'><input type='hidden' name='MAX_FILE_SIZE' value='2048000'><input name='userfile' type='file'><br><br><input type='submit' value='Uploaden'></form></center></body></html>");
document.close();
}
<!-- Error function when visitors gets the password wrong -->
function error() {
document.write("<html><head><title>Password incorrect!</title></head> <body bgcolor='#FFFFFF'><p><center><b><font face='Century Gothic'>Helaas, je hebt een fout wachtwoord ingevuld. <br>Als je het wachtwoord wil hebben, kun je dat altijd bij mij opvragen.<br><br><br><br>Bas.</font></b></center></p></body></html>");
document.close();
}
//Stop hiding-->
</script>
</head>
<body>
<p><center><b><font face="Century Gothic">Voer het wachtwoord in om verder te gaan naar de file uploader- en browser.<br>Indien er geen inlogschermpje komt, is de functie niet compatibel met jouw browser.</font></b></center></p>
<!-- Wachtwoord functie -->
<script language="JavaScript" type="text/javascript">
<!--Hide from non-JavaScript Browsers
var password = prompt("Uw wachtwoord a.u.b.:","");
//EERSTE PASSWORD
switch(password){
case"password" : window.location="javascript:correct()"
break ;
//TWEEDE PASSWORD
case"password" : window.location="javascript:correct()"
break ;
//DERDE PASSWORD
case"password" : window.location="javascript:correct()"
break ;
//FOUTMELDING BIJ VERKEERD WACHTWOORD
default : window.location="javascript:error()"
break ;
}
//Stop hiding-->
</script>
</body><html>
<head>
<title>Uploaden...</title>
</head>
<body>
<!--webbot bot="HTMLMarkup" startspan --><?
global $_FILES;
$filename = $_FILES['userfile']['name'];
$uploadname = $_FILES['userfile']['name'];
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
echo "Het bestand is succesvol upgeload: $uploadname";
}
?>
<!--webbot bot="HTMLMarkup" endspan -->
<br><br>
Indien niet wordt aangegeven dat de upload is gelukt, is het mislukt.
</body>
</html>