Re: Variable in $_FILES?
| From: | Dimitri Marshall | Date: | Tue, 02 Dec 2003 01:05:04 +0000 |
| Subject: | Re: Variable in $_FILES? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171527@lists.php.net to get a copy of this message | ||
Just to answer my own question, but for reference for anyone else who has
this problem, I made a simple error (not very experienced with PHP). Anyway,
turns out that 'object$objectNumber' is different than 'object'$objectNumber
and also different that just $objectNumber. As most of you know, putting ' '
around a variable makes PHP print it out exactly like that (ie.
'$objectNumber' = $objectNumber in PHP) whereas I just wanted the variable
properties to actually be put into the $_FILES function (or whatever it is).
I couldn't figure out how to put 'object'$objectNumber together so I just
changed it to simply $objectNumber, so it now works.
This is what the code is now:
$file = $_FILES{$objectNumber};
$fileName = $file['name'];
$filetmp = $file['tmp_name'];
... and everything works.
Dimitri Marshall
"Dimitri Marshall" <webmaster@dyntdesign.com> wrote in message
news:20031202004839.86219.qmail@pb1.pair.com...
> 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