tags:

views:

35

answers:

1

Hi All,

I am using symfony1.1. In my app I am required to upload some image files through admin and store their content as blob in DB.

Here's how I am doing it,
1. Getting the fopen handle on the uploaded file.
2. Pass this to stream_get_contents($handle);
3. Store the content in as blob.

Everything works fine on WinXP, but on live server which runs on Linux, I get strange file name as "object id #5" for the file I uploaded which can't be found. I checked both configurations, they are same.

Please does anyone know whats happening.

Thanks.

Update: The problem is with the different versions of PHP as suggested by the comments, nothing to do with OS's. Thanks all.

A: 

"object id #5" means that you used an object as filename.
var_dump() variable before creating a file to see what is inside.

Naktibalda
Yes, but in windows the __toString() gets called to convert it to string, whereas in Linux the __toString is not getting called. I have made a work around for now, but I am curious why is this so.
Harsha
Same version of PHP?
Naktibalda
@Harsha Could it be that you have different PHP versions on each machine? Before version 5.2.0 PHP is a bit picky about automatically using __toString(). http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
Manos Dilaverakis
ok, yes versions differ. On linux its 5.1 and on windows its 5.2.6. Thanks guys for the help.
Harsha