Hej,
jeg fandt et upload script her den anden dag men når der uploades ryger de uploadet ting ind i den samme mappe som mine
upload script filer (altså .php filer) og jeg vil meget gerne have hjælp til at rette det til at der kommer en fil i min root som hedder "uploaded"
uploadForm1.php:
<html>
<head>
<title># of Files to Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="uploadForm2.php">
<p>skriv antallet af boxse du skal bruge her under. Max = 9.</p>
<p>
<input name="uploadNeed" type="text" id="uploadNeed" maxlength="1">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
uploadForm2.php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" enctype="multipart/form-data" method="post" action="processFiles.php">
<p>
<?
// start of dynamic form
$uploadNeed = $_POST['uploadNeed'];
for($x=0;$x<$uploadNeed;$x++){
?>
<input name="uploadFile<? echo $x;?>" type="file" id="uploadFile<? echo $x;?>">
</p>
<?
// end of for loop
}
?>
<p><input name="uploadNeed" type="hidden" value="<? echo $uploadNeed;?>">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
processFiles.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Ny side 3</title>
</head>
<body>
<?
$uploadNeed = $_POST['uploadNeed'];
// start for loop
for($x=0;$x<$uploadNeed;$x++){
$file_name = $_FILES['uploadFile'. $x]['name'];
// strip file_name of slashes
$file_name = stripslashes($file_name);
$file_name = str_replace("'","",$file_name);
$copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$file_name);
// check if successfully copied
if($copy){
echo "$file_name | uploaded sucessfully!<br>";
}else{
echo "$file_name | could not be uploaded!<br>";
}
} // end of loop
?>
</body>
</html>