Re: Variable post as array
| From: | Colin Guthrie | Date: | Wed, 05 Mar 2008 12:24:14 +0000 |
| Subject: | Re: Variable post as array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-271009@lists.php.net to get a copy of this message | ||
Pieter du Toit wrote:
> I ran a print_r on it and this is the results
>
> Array ( [txtPhoto] => Array ( [name] => g1.jpg [type] => image/pjpeg
> [tmp_name] => /tmp/php3qkA4A [error] => 0 [size] => 17008 ) )
>
> The image received here must be inserted into a database as binary it looks
> like it.
"on it" is very vague dude. Be more specific... show code!!!
From later posts it appears you are using register_globals to access the
file as if it is a local variable.
$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"),
filesize($txtPhoto)));
For file upload elements $txtPhoto will be an array. use
$txtPhoto['tmp_name'] or something. It's all in the manual.
PS just avoid register globals anyway, it's evil.
Col