You are here: foreach $_FILES « PHP « IT news, forums, messages
foreach $_FILES

Posted by "Shaun" on 09/26/09 11:34

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
this is happening please?

Thanks for your advice.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация