I'm new to php and I'm trying to write a script for a webpage. The idea is to be able to upload multiple files. Not only that, but I'd like to be able to choose from a form menu what directory to upload the files to. I'd like for all of this to go into one script. Grumbler let me know that I could use the move_uploaded_file function, but I have no idea how to implement this. Can anyone give me an example? Here's the code I have so far. And the idea is to choose a directory from the menu list and upload the files to it.
<?php
if ($imageFile !="none") {
for ($k =0; $k < count($imageFile); $k++) {
copy($imageFile[$k], "/home/heikou/public_html/test/$imageFile_name[$k]");
}
}
?>
<head>
<title>AvatarAdmin</title> </head>
<body>
<form action=<?php echo $PHP_SELF; ?> enctype="multipart/form-data" method="post">
<p>
<select name="age">
<option value="ah_megamisama">Ah! My Goddess</option>
<option value="anime_girls">Anime Girls</option>
<option value="cc_sakura">Card Captor Sakura</option>
<option value="chrono_cross">Chrono Cross</option>
</select>
</p>
<p>
<input type="file" size="40" name="imageFile[]"><br>
<input type="file" size="40" name="imageFile[]"><br>
<input type="file" size="40" name="imageFile[]"><br>
<input type="file" size="40" name="imageFile[]"><br>
<input type="file" size="40" name="imageFile[]"></p>
<input type="submit" name="submit" value="Add Images">
<input type="submit" value="Cancel" name="cancelit">
</form>
</body>