Forum Moderators: coopster

Message Too Old, No Replies

loading object tag src dynamically

         

billybob

6:24 pm on Dec 6, 2008 (gmt 0)

10+ Year Member



I wonder how to load data into an object via php like so:

<OBJECT ...>
<PARAM NAME="SRC" VALUE=loaddata.php?data=thefile.xyz >;
</OBJECT>

Whereas the loaddata.php reads the file from a certain directory.
The problem is,if the reading method in the loaddata.php

is, for instance, readfile($_GET['data']), the data are read as binary and the Object is not displayed.

Is there any other to read the VALUE via php ?

Thanks.

Anyango

6:35 am on Dec 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




the data are read as binary and the Object is not displayed

loaddata.php needs to tell browser what type of data content that is, for example if that was an .swf or a .jgp you need to send header that the content i am sending is .swf or an image.

For example

<?php
header('Content-type: application/pdf');
readfile('original.pdf');
?>

Then it should work ;)

[php.net...]

billybob

10:44 pm on Dec 7, 2008 (gmt 0)

10+ Year Member



Thank you.
Your advice made me recognize (after 3 hours...) that i had set the wrong MIME type.