class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
My form is for a newsletter script that will have many articles on it, with each article having an image. The number of articles is determined by the user.
EXAMPLE
// process the form
for($i=1; $i<=count($_POST['art_headline']); $i++){
$headline = strip_tags($_POST['art_headline']);
$article = strip_tags($_POST['article']);
$art_img = $_FILES['art_img'];
$sql = mysql_query("INSERT INTO articles (art_headline, art_txt, art_img) VALUES ('{$art_headline[$i]}','{$art_txt[$i]}','{$art_img[$i}')") or die(mysql_error());
}
EXAMPLE
<form method="post" enctype="multipart/form-data">
headline: <input type="text" name="art_headline[]" />
article: <textarea name="art_text[]"></textarea>
image: <input type="file" name="art_img[]" />
</form>
How would I go about using the upload class to process the form, plus get its name and insert it into the db?