Aiko_Saule Posted August 20, 2006 Report Posted August 20, 2006 Nu tā man ir datubaze ar nosaukumu aiko un tajā tabula Upload struktūra sekojoša Id tinyint(11) UNSIGNED auto_increment name varchar(255) size varchar(255) type varchar(255) content mediumblob BINARY Es dabuju bmp failu datubazee bet nevaru dabuut ara - ar ara es domaju izvadiit uz ekrana. Man ir šads fails UploadXX3.php <html> <head> <title>Download File From MySQL</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php // -------------------------- maina bufera vetribu --------------------------------- $hostname="localhost"; $username="yyyyyyyy"; $password="xxxxxxx"; $dbName="aiko"; $usertable="Upload"; // ------------------------pievienojas datubazei-------------------------------------- MYSQL_CONNECT ($hostname,$username,$password) OR DIE ("nav servera"); mysql_select_db("$dbName") or DIE ("Nav DB"); $query = "SELECT id, name FROM Upload"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <a href="UploadXX3.php?id=<?=$id;?>"><?=$name;?></a> <br> <? } } mysql_close(); ?> </body> </html> varu izvadiit faila nosaukumu bet failu ka bildi nevaru.
goldy Posted August 20, 2006 Report Posted August 20, 2006 varbūt tad selektē to bildi nevis viņas nosaukumu? un lai izvadītu bildi tev vajadzēs padot pareizos headerus pirms tam. labāk dari tā, ka iekš DB turi tikai faila nosaukumu, bet bildi liec vienkārši kā failu, un tad ar <img src .... /> parādīsi bildi.
Grey_Wolf Posted August 20, 2006 Report Posted August 20, 2006 Es dabuju bmp failu datubazee bet nevaru dabuut ara Vienkaarshi un geniaali Tas jau vien ka glabaa bildi ieksh DB ir "skaisti" Bet vel BMP tas ir vienkaarshi geniaali !!!
Gundars Posted August 20, 2006 Report Posted August 20, 2006 varu izvadiit faila nosaukumu bet failu ka bildi nevaru. Protems, ka nevarfi izvadiit bildi, jo standartasituacijas html ir vien scripts, bet prieksh bildes ir otrs scripts. Johtml nesatur sevii bildes datus, tikai noradi nrowserism no kadas vietas njemama pati bilde.
goldy Posted August 20, 2006 Report Posted August 20, 2006 neņigājas vači, labi ka vēl tifu nemēgina dabūt ārā :)
Vebers Posted August 20, 2006 Report Posted August 20, 2006 Ir jaizvada ari faila headeri! <img src="blabla.php?imgID=<?php echo $id; ?>" alt="image"/> un blabla.php saturs : <?php header("Content-type: image/bmp"); //piesledzas DB; $q = mysql_query("SELECT content FROM Upload WHERE id=".intval($_GET['imgID']).""); $r = mysql_fetch_row($q); echo $r[0]; ?> Nu kaut kaa taa.. domu cerams vismaz saprati.
bubu Posted August 20, 2006 Report Posted August 20, 2006 A kas tifam vainas (izņemot to, kas browseri to normāli nerāda)? tif ir kudiš labāks formāts par bmp.
goldy Posted August 20, 2006 Report Posted August 20, 2006 bubu un tu pats arī atbildēji :) -- izņemot to, kas browseri to normāli nerāda --
Aiko_Saule Posted August 20, 2006 Author Report Posted August 20, 2006 Warning: Cannot modify header information - headers already sent by - ko tie hideri dara ?
Vebers Posted August 20, 2006 Report Posted August 20, 2006 Vismaz pameginaji iemest savu erroru google ? vai tepat foruma search?
Paulinjsh Posted August 21, 2006 Report Posted August 21, 2006 Gan jau pirms tam atstarpe ielikta, enter nospiests vai arī maģiskie 3 neredzamie simboli :)
Recommended Posts