Upload vha. tabel id.
Er i tvivl om hvad jeg gør forkert i de her koder.Admin.php
echo "<a href=\"upload.php?id=".$row['id']."&type=vare\">Upload billede</a><br>";
upload.php
<?php
//Lavet af Henrik
// forbindelse
$con = mysqli_connect('localhost', 'root', '', 'electron');
$minQuery = "SELECT * FROM ".$type." WHERE id=".$_GET['id'];
$resultat=mysqli_query($con, $minQuery) or die(mysqli_error($con));//henter fra databasen
//behandler resultatet
while($row=mysqli_fetch_array($resultat)){
?> <center>
<form action="uploader.php?type=<?php echo "$type"; ?>&id=<?php echo $_GET['id']; ?>" method="post">
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Vælg en file til upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
<?php
}
mysqli_close($con);
?>
uploader.php
<?php
//hvor filen bliver gemt.
$target_path = "uploads/";
//tilføjer originalt filenavn til valgte sti.
$target_path = $target_path . basename( $_FILES['uploadedfile']['mrk']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['mrk']).
" Uploadet!";
} else{
echo "Der var en fejl, prøv venligst igen!";
}
?>
Nogen der har forslag til hvordan den kan laves? Eller laves om?