Re: foreach $_FILES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaun wrote:
Hi,

I have a form on my site with many file fields for users to upload files. I am trying to verify that for each file uploaded it corresponds with the name of the file field i.e.

<tr>
   <td>File_1.CSV:</td>
   <td><input type="file" name="File_1.CSV"></td>
</tr>
<tr>
   <td>File_2.CSV:</td>
   <td><input type="file" name="File_2.CSV"></td>
</tr>

However if I loop through the $_FILES array like this:

foreach( $_FILES as $key => $value ){
   echo '$key = '.$key.'<br />';
   echo '$value = '.$value.'<br />';
}

$key = File_1_CSV
$value['name'] = File_1.CSV
$key = File_2_CSV
$value['name'] = File_2.CSV

The . is replaced with an underscore in the $key value. I could get around this with a substr() but it seems a little inelegant, can anyone tell me why

a fullstop/dot is not allowed in the name of a variable in php.

// following line errors out...
echo $File_2.CSV;

this is mentioned in the manual.

this is happening please?

Thanks for your advice.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux