Re: [PHP] $_FILES help. Counting help

2003-05-27 Thread Jordan S. Jones
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 "Sorry! MP3's and .EXE's are disallowed!";
   }else{
   //mkdir("upload/" . $_POST['dir'],0777);
   copy($_FILES['file']['tmp_name'], "images/" . 
$_FILES['file']['name']);
   unlink($_FILES['file']['tmp_name']);
   echo "".$i." File(s) Uploaded Successfully to " . 
$_POST['dir'] . " directory!";
   }
   }else{
   echo "You must specify a file to upload\n";
   echo "< < 
back\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


[PHP] $_FILES help. Counting help

2003-05-27 Thread Didier McGillis
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 "Sorry! MP3's and .EXE's are disallowed!";
   }else{
   //mkdir("upload/" . $_POST['dir'],0777);
   copy($_FILES['file']['tmp_name'], "images/" . 
$_FILES['file']['name']);
   unlink($_FILES['file']['tmp_name']);
   echo "".$i." File(s) Uploaded Successfully to " . 
$_POST['dir'] . " directory!";
   }
   }else{
   echo "You must specify a file to upload\n";
   echo "< < 
back\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