Re: Variable post as array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That is the problem, i can see the name of the file with $txtPhoto['name'] 
but when i use the same with temp_name, i get nothing, one weird thing is 
this [error] => 0 [size] => 17008  , what is that?

this is the code that is giving the problem
$txtPhotoData = addslashes(fread(fopen($txtPhoto, "r"), 
filesize($txtPhoto)));

And this is the error

Warning: fopen() expects parameter 1 to be string, array given in
> /usr/www/users/zululr/marketplace/myzululand/specials_proc.php on line 49

I did not do the code im just trying to help out, if never use this kind of 
code to work with photos, i normally use move_uploaded_file and put the path 
in the databse, but it look like this code puts the photo in the database as 
binary or something.


"Colin Guthrie" <gmane@xxxxxxxxxxxxxx> wrote in message 
news:fqm3de$6k1$1@xxxxxxxxxxxxxxxx
> 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
> 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux