[PHP] Variable in $_FILES?

2003-12-01 Thread Dimitri Marshall
Hi there,
This is what I'm trying to do:

$pic = $_FILES['object$objectNumber'];
$picName = $pic['name'];
$pictmp = $pic['tmp_name'];

$objectNumber is being defined, but for some reason this code won't work.
Can someone tell me why and also what I can do to make it work?

Thanks in advance,
Dimitri Marshall

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



Re: [PHP] Variable in $_FILES?

2003-12-01 Thread Kelly Hallman
On Mon, 1 Dec 2003, Dimitri Marshall wrote:
 This is what I'm trying to do:
 $pic = $_FILES['object$objectNumber'];
 $picName = $pic['name'];
 ...
 $objectNumber is being defined, but for some reason this code won't work.
 Can someone tell me why and also what I can do to make it work?

$_FILES[object$objectnumber] will do it...
( or $_FILES['object'.$objectnumber] )

When you enclose a string in double quotes () PHP will interpolate 
variables within the string, as you are trying to do.

When you enclose a string with '' it will be treated as a literal.

You may also consider object{$objectnumber} if you need to avoid 
ambiguities with the rest of your string. I personally think it's a good 
habit to use the curlies anyway, but I'm sure that's a matter of debate..

--
Kelly Hallman
// Ultrafancy

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