Re: returning the index number part2

From: Date: Tue, 05 Jun 2007 17:59:33 +0000
Subject: Re: returning the index number part2
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-256115@lists.php.net to get a copy of this message
On Tue, 2007-06-05 at 09:33 -0700, Jim Lucas wrote: > Robert Cummings wrote: > > On Tue, 2007-06-05 at 17:16 +0100, blueboy wrote: > >> if I have an array of 3 images > >> > >> <table class="signup_table"> > >> <tr> > >> <td> 1.</td> > >> <td><input name="userfile[]" type="file"></td> > >> </tr> > >> <tr> > >> <td> 2.</td> > >> <td><input name="userfile[]" type="file"></td> > >> </tr> > >> <tr> > >> <td>3.</td> > >> <td><input name="userfile[]" type="file"> > >> </td> > >> </tr> > >> </table > >> > >> How do I access the filename? Like this? > >> > >> echo $fileName1 = $_FILES['userfile']['name'][0]; > >> echo $fileName2 = $_FILES['userfile']['name'][1]; > >> echo $fileName3 = $_FILES['userfile']['name'][2]; > > > > No, like this: > > > > echo $fileName1 = $_FILES['userfile'][1]['name']; > > echo $fileName2 = $_FILES['userfile'][2]['name']; > > echo $fileName3 = $_FILES['userfile'][3]['name']; > > > > Cheers, > > Rob. > I suggest to the op that they use print_r() on $_FILES and all will be revealed You mean: echo "<pre>\n"; print_r( $_FILES ); echo "\n</pre>\n"; :) Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#256115) next »