declaring dynamic globals
| From: | Kathleen Ballard | Date: | Wed, 20 Sep 2000 19:23:03 +0000 |
| Subject: | declaring dynamic globals | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17235@lists.php.net to get a copy of this message | ||
Dear List,
I am trying to create a function that will clean up the file name and copy
an uploaded file to its final destination. The one I have relies on
declaring the globals $uploadFile , $uploadFile_name and $uploadFile_size.
However, my current application calls for 3 upload fields that have unique
names.
I have tried to pass the field name as an argument in the function call.
Then use that value to declare the globals like so:
function UploadImage($Field)
{
global ${$Field};
global ${$Field . "_name};
global ${$Field . "_size};
}
But I get a parse error "expecting string" on the first global declaration.
Is there a way to do what I want to do?
Kathleen