This is my second question on the forum. I've exhausted all avenues of researching this on my own. I have an HTML form the will be processed with a script. In this form the user has the option to upload up to 10 images.... each image has its own entry field like this...
<form action="upload.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> The php is this...
$client = $_POST['company']; $date = date("mdy"); $clientFolder = $client . $date; mkdir('../../../uploads/' . $clientFolder . '/', 0700); $folderPath = '../../../uploads/' . $clientFolder . '/'; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists($folderPath . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $folderPath . $_FILES["file"]["name"]); echo "Stored in: " . $folderPath . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } I can get one file to upload correctly but not more than one. I used this tutorial. http://www.w3schools.com/php/php_file_upload.asp
Do I need to loop through these? Or do I need unique name's and id's? Any help will be appreciated! I'm new to php.... I have to say though.. I love it!!! so far...