Ik heb geprobeerd om eens het bestand te openen met fopen, maar dit resulteerde in de volgende foutmelding:
Warning: fopen("C:\Joachim\shoutbox_pre.php","r+") - No such file or directory in /home/.sites/33/site116/web/life/wedstrijd2.php on line 53
Nochtans BESTAAT het bestand!
Het formulier:
<form name=file entype="multipart/form-data" action=wedstrijd2.php method=post>
<input type="hidden" name="MAX_FILE_SIZE" value="50000">
<table>
<tr><td><span class=opsomming>Bestand:</span></td><td><input type=file name=bestand></td></tr>
<tr><td><span class=opsomming>Titel:</span></td><td><input type=text name=titel></td></tr>
<tr><td><span class=opsomming>Jouw naam:</span></td><td><input type=text name=jnaam></td></tr>
<tr><td><span class=opsomming>E-mail(optioneel):</span></td><td><input type=text name=email></td></tr>
<tr><td><span class=opsomming>Besturingssysteem:</span></td><td><select name=besturing><option selected value=Windows>Windows</option><option value=Macintosh>Macintosh</option><option value=Linux>Linux</option></select></td></tr>
<tr><td colspan=2><center><input type=submit name=upload value="Verzend"></center></td></tr>
</form>
Hieronder de code waar je naar vroeg:
if($upload)
{
$bestand = strip_tags($bestand);
$title = strip_tags($titel);
$jnaam = strip_tags($jnaam);
$email = strip_tags($email);
$besturing = strip_tags($besturing);
$error = 0;
$bnaam = $bestand_name;
$check = fopen($bestand, "r+");
if($bestand_size>5000)
{
echo "<font color=red>Bestand is te groot!</font>";
$error++;
}
if(strlen($bestand) < 3)
{
echo "<font color=red>Bestandsnaam niet ingevuld!</font>";
$error++;
}
if($error == 0)
{
$bestandsnaam = time() . $bnaam;
$dest = "
https://www.meestersites.be/life/files/" . $bnaam;
copy($bestand,$dest);
mysql_query("INSERT INTO life (naam, titel, user, email, bestuur) VALUES ('$bestandsnaam', '$titel', '$jnaam', '$email', '$besturing')") or die(mysql_error());
if($check == "true" || $check== 1)
{
echo "Bestand goed opgenomen";
}
}
}
Ik hoop dat dit je wat meer kan helpen...