Nu har jeg lavet en kode, hvor du bare skal ændre $filecount og $uploaddir
$filecount er hvor mange filer der kan uploades
$uploaddir er hvilken placering på harddisken de får.
<?
$filecount = 4;
$uploaddir = 'c:\\\\apache\\\\apache\\\\htdocs\\\\udvdk\\\\';
for ($i = 1; $i <= $filecount; $i++) if (isset($_FILES["userfile".$i])) $filespassed = true;
if ($filespassed == true) {
for ($i = 1; $i <= $filecount; $i++) {
echo "$i...";
if (isset($_FILES["userfile".$i])) {
echo "isset";
if (move_uploaded_file($_FILES['userfile'.$i]['tmp_name'], $uploaddir.$_FILES['userfile'.$i]['name'])) $files[]=$_FILES['userfile'.$i]['name'];
else {
print "Possible file upload attack! Here's some debugging info:\\n";
print_r($_FILES);
}
}
echo "";
}
exit;
$fileoutput = "?";
foreach ($files as $key => $val) $fileoutput .= "file".($key+1)."=".$val."&";
$fileoutput = substr($fileoutput, 0, -1);
header("Location: nyside.php".$fileoutput);
exit;
}
else {
?>
<form enctype="multipart/form-data" action="<?=$PHP_SELF?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="300000" /><? // 300kb ?>
<?
for ($i = 1; $i <= $filecount; $i++) echo "Send this file $i: <input name=\\"userfile".$i."\\" type=\\"file\\" />";
?>
<input type="submit" value="Send File" />
</form>
<?
}
?>
Når filerne er uploaded sender den dig videre til nyside.php?file1=FILNAVN1&file2=FILNAVN2 osv.
/AC
[Redigeret d. 24/01-04 13:32:00 af AC]