Page 1 of 1

load swf from mysql ?

Posted: Thu Nov 10, 2005 4:14 am
by z3phir
hi

i made a script to add some banners to a site. the banners are uploaded to a mysql data base. the upload it works ok. when i try to display the banners it works for jpg and gif files but for swf it fails any ideea why ?

i use this code to diplay the banners

to get the file from the db

Code: Select all

if(isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
    	$imageid=$_REQUEST['id'];
    	$tip=$_REQUEST['tip'];
        $sql = "SELECT image FROM pub WHERE id='$imageid'";
        $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
        if ($tip=='jpg') {header("Content-type: image/jpg");}
        if ($tip=='gif') {header("Content-type: image/gif");}
        if ($tip=='swf') {header("Content-type: application/x-shockwave-flash");}
        echo mysql_result($result, 0);
    }
    else {
        echo 'Imaginea nu este disponibila';
    }
to diplay the banners

Code: Select all

if (($objLine->image_type=='jpg') or ($objLine->image_type=='gif')){
?>
<img src="pub.php?id=<?echo $objLine->id;?>&tip=<?echo $objLine->image_type;?>" width="120" height="<?echo $objLine->inaltime;?>" alt="" border="0" />
<?}
elseif ($objLine->image_type=='swf') {?>
<object type="application/x-shockwave-flash" data="pub.php?id=<?echo $objLine->id;?>&tip=<?echo $objLine->image_type;?>" width="120" height="<?echo $objLine->inaltime;?>">
<param name="movie" value="pub.php?id=<?echo $objLine->id;?>&tip=<?echo $objLine->image_type;?>" />
<param name="loop" value="false" /> 
<param name="menu" value="false" />
</object>
<?}