Didier,
My guess is in your HTML, you have the input(s) named as 'file'.. Because of the way that PHP handles it's POST/GET variables, you will want to redeclare your input names in your HTML to 'file[]'... This basically defines that it is an array..


Hope that helps,
Jordan

Didier McGillis wrote:

I have three file fields in a form. I need it to upload those three items or two or one. I can get it to upload one, but not all three, habing trouble with the for loop and how I get a value of $i.

if(isset($_POST['upload'])){
if (!empty($_FILES['file']['name'])){
$formats = array('mp3','exe');
if(in_array(strtolower(substr($_FILES['file']['name'],-3)),$formats)) {
echo "<font face=\"verdana,arial,helvetica\" size=\"2\" color=\"#000000\"><b>Sorry! MP3's and .EXE's are disallowed!</b></font>";
}else{
//mkdir("upload/" . $_POST['dir'],0777);
copy($_FILES['file']['tmp_name'], "images/" . $_FILES['file']['name']);
unlink($_FILES['file']['tmp_name']);
echo "<font face=\"verdana,arial,helvetica\" size=\"2\" color=\"#000000\"><b>".$i." File(s) Uploaded Successfully to <b>" . $_POST['dir'] . "</b> directory!</b></font>";
}
}else{
echo "<font face=\"verdana,arial,helvetica\" size=\"2\" color=\"#000000\"><b>You must specify a file to upload</b></font><br>\n";
echo "<font face=\"verdana,arial,helvetica\" size=\"2\" color=\"#000000\"><a href=\"javascript:history.back()\">< < back</a></font><br>\n";
exit();
}
}


$i =$_FILES['file']['name'];
is it for ($i=1;$i<4;i++) {
run code
}

or am I way off, help please.

thanks,

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to