adding multiple files PHP
<p>I have the working script below but instead of image 1, image 2, image 3, image 4 being next to the boxes I want different names for each. Is there an easy way to do this?
Thanks in advance!!
Also where would I put 
    header("Location: thankyou.php");<br>
    exit();
Because at the moment after putting this in, it just directs straight to the thankyou.php not the page below (document.php)</p>

<pre><code>&lt;?php
$max_no_img = 4; // Maximum number of images value to be set here
echo "&lt;form method=post action='' enctype='multipart/form-data'&gt;";
echo "&lt;table border='0' width='400' cellspacing='0' cellpadding='0' align=center&gt;";
for ($i = 1;$i &lt;= $max_no_img;$i++) {
    echo "&lt;tr&gt;&lt;td&gt;Images $i&lt;/td&gt;&lt;td&gt;
&lt;input type=file name='images[]' class='bginput'&gt;&lt;/td&gt;&lt;/tr&gt;";
}
echo "&lt;tr&gt;&lt;td colspan=2 align=center&gt;&lt;input type=submit value='Add Image'&gt;&lt;/td&gt;&lt;/tr&gt;";
echo "&lt;/form&gt; &lt;/table&gt;";
while (list($key, $value) = each($_FILES['images']['name'])) {
    //echo $key;
    //echo "&lt;br&gt;";
    //echo $value;
    //echo "&lt;br&gt;";
    if (!empty($value)) { // this will check if any blank field is entered
        $filename = rand(1, 100000) . $value; // filename stores the value
        $filename = str_replace(" ", "_", $filename);
        $add = "upload/$filename"; // upload directory path is set
        copy($_FILES['images']['tmp_name'][$key], $add);
        echo $add;
        //  upload the file to the server
        chmod("$add", 0777); // set permission to the file.

    }
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
