inspire Posted September 24, 2007 Share Posted September 24, 2007 why the open or download message box not appear and the unknown text display when click the link. how to solve this header already send problem. anyone know about it....pls help slide-view.php <?php mysql_connect("localhost", "root", "") or die("no connection"); mysql_select_db("gddatab") or die("no database"); if(isset($_GET['id1'])) { $id= $_GET['id1']; echo $id; $query = "SELECT t_name, t_type, t_size, t_content FROM ots_slide WHERE t_id = '$id1'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo "<meta http-equiv=\"refresh\" \"Content-length: $size\" >"; echo "<meta http-equiv=\"refresh\" \"Content-type: $type\" >"; echo "<meta http-equiv=\"refresh\" \"Content-Disposition: attachment; filename=$name\" >"; echo $content; exit; } ?> output Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 19 Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 20 GIF89a÷îîîlW{mX{mX|çæèr^€æåçÜÙÞt`‚–ˆ ëêëèçéêéꪟ²éèéoZ}ĽÉììì°¦·nY|nY}ÏÊÓ¸°¿p[~˜Š¢ÝÚß“…žÎÉÒííîs_íííììí}˜¿¸ÅÉÃÎÍÈчv“‚qØÕÛàÞâåäæÌÆÐ~l‹¼´Â§›¯Ú×Ü„sáßãÛ×ÝÞÜà‘‚›£—¬¬¢´ž‘§Ÿ“©ÑÍÕÐÌÔwc„ÓÏ×™Œ£ãá亲ÀÖÒØÒÎÖ¥™®›¤|j‰ØÔÚµ¬»®£µ€›¢•ª×ÓÙo»ǩ±ßÝáåãæq]€œ¦äã徶Ãyf†•†ŸÈÂÌ’ƒ‹{—o[~áßâÁ¹ÆÕÐ×±¨¸ÊÅγªºÇÀËâàäãâåÅ¿ÊŽ™ÙÖÜq\·®½ÂºÇuaƒ½µÂêêë{i‰xe†äâåÆÀË®¤¶›ÔÐן’¨ßÜànŒ¦¨œ°Œ|—‰x”ëëìvb„¦š®—‰¡¬¡³»³Áp\¡•ª´«»š¤}kŠàÝáÌÇÐvc„ÚÖÜzhˆÞÛà…u’²©¹¶¼Ã¼Èubƒééꤘ¬£–«©ž±’ƒœÖÒÙšŒ¤œ¥ÈÂͦ›®ÙÕÛÉÃÍÆ¿ÊšƒrÑÌÔ…t‘·¯¾¨°µ¬¼« ³€nÇÁ̶½²¨¹§ˆx”€o»²À´ª»ˆw“Šy•ËÆÏ¥™¿·Ä¤˜¹±ÀÁºÆ€š¯¥¶ÛØÝÒÍÕÊÄΊz–×ÓÚ±§¸˜‹¢¡”©³©º “©zg‡¾¶Ä½µÃ|i‰ž’¨« ²ËÅφu’“„™‹£›Ž¥‰y•ÐËÓxe…ÕÑØ£µÏÊÒÀ¸ÅÓÏÖ¢–«¸¯¾§œ¯âà㢴¼³ÁmŒ‡v’‘‚œÀ¹Åyf‡¹°¿¯¥·‚pŽwd…”†Ÿ”…žÅ¾É{hˆ•‡ !ù,ÿH° Áƒ*,( ¡Ã‡Hœ8q‚E‹2f|À‘ã•B^ð㇌I'( ¨\Ù¡e 0až9Ó¨Qž<… åخٚ5R‚vvèP95j† Y*HŠ§ÙæÌ•*‰Up%²rrÁÕS¢DÇ´‘Ë Õ;ËZå²ÂÖŽ pAˆ™»‰–‘»oÞÈØ»MR•¿È4Ö0NÜ”Ãæ(V¼g†Çx%ÛA™R @A2+«ô¤3 :§jˆ&'ŽÓ¿zýùs¤õ4H3b?zëÛzô\bÁ»Z: –Ô xñb¢øð¡ÁüÚ³"Ðݸ©õM‚u뻶h7¥H‘¯.àWÿD¤|¨E‹J•Yÿ‰š…÷¼ÉêA_UŸ>ØVèGƒFX”ÿÁÀ€!DÃMÎb†J4È#D!9aT¨Imx¡!)TthI&"„(.\”hŒ+)¤H!#´8Â0nM4VÀ 8vrÃŽ·üà£4: ZéŒHN‚Ä’º ᤠPb2Æ”†Ò•0diË\v™Á— ‚H dÊ! h2È lbáæ pZóÅœ<Ô Æl°ÅžMô‰ÂŸ*(„JÀˆ"êÀ¢‹:âBšF TZ)‑xD ©¦tú zÀÁ¨`ꩨ¦ªêª¬¶êê«°Æ*무Öjë¸æªë®¼öêë¯ÀÞ; Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/ Share on other sites More sharing options...
darkfreaks Posted September 24, 2007 Share Posted September 24, 2007 put ob_start(); at the top of your file let me know if this helps Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/#findComment-353803 Share on other sites More sharing options...
jitesh Posted September 24, 2007 Share Posted September 24, 2007 Are you giving mime content type ? (header("Content-type: $type")) Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/#findComment-353805 Share on other sites More sharing options...
darkfreaks Posted September 24, 2007 Share Posted September 24, 2007 lol you cant do that you need image/png or whatever Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/#findComment-353808 Share on other sites More sharing options...
inspire Posted September 24, 2007 Author Share Posted September 24, 2007 why the open or download message box not appear and the unknown text display when click the link. how to solve this header already send problem. anyone know about it....pls help when i try with ob_start();, the error solved but.....i cannot open the image/document .i just can download the file by click the save message box.pls help. ??? slide-view.php <?php mysql_connect("localhost", "root", "") or die("no connection"); mysql_select_db("gddatab") or die("no database"); if(isset($_GET['id1'])) { $id= $_GET['id1']; echo $id; $query = "SELECT t_name, t_type, t_size, t_content FROM ots_slide WHERE t_id = '$id1'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo "<meta http-equiv=\"refresh\" \"Content-length: $size\" >"; echo "<meta http-equiv=\"refresh\" \"Content-type: $type\" >"; echo "<meta http-equiv=\"refresh\" \"Content-Disposition: attachment; filename=$name\" >"; echo $content; exit; } ?> output Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 18 Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 19 Warning: Cannot modify header information - headers already sent by (output started at C:\server\www\OTS\slide-view.php:11) in C:\server\www\OTS\slide-view.php on line 20 GIF89a÷îîîlW{mX{mX|çæèr^€æåçÜÙÞt`‚–ˆ ëêëèçéêéꪟ²éèéoZ}ĽÉììì°¦·nY|nY}ÏÊÓ¸°¿p[~˜Š¢ÝÚß“…žÎÉÒííîs_íííììí}˜¿¸ÅÉÃÎÍÈчv“‚qØÕÛàÞâåäæÌÆÐ~l‹¼´Â§›¯Ú×Ü„sáßãÛ×ÝÞÜà‘‚›£—¬¬¢´ž‘§Ÿ“©ÑÍÕÐÌÔwc„ÓÏ×™Œ£ãá亲ÀÖÒØÒÎÖ¥™®›¤|j‰ØÔÚµ¬»®£µ€›¢•ª×ÓÙo»ǩ±ßÝáåãæq]€œ¦äã徶Ãyf†•†ŸÈÂÌ’ƒ‹{—o[~áßâÁ¹ÆÕÐ×±¨¸ÊÅγªºÇÀËâàäãâåÅ¿ÊŽ™ÙÖÜq\·®½ÂºÇuaƒ½µÂêêë{i‰xe†äâåÆÀË®¤¶›ÔÐן’¨ßÜànŒ¦¨œ°Œ|—‰x”ëëìvb„¦š®—‰¡¬¡³»³Áp\¡•ª´«»š¤}kŠàÝáÌÇÐvc„ÚÖÜzhˆÞÛà…u’²©¹¶¼Ã¼Èubƒééꤘ¬£–«©ž±’ƒœÖÒÙšŒ¤œ¥ÈÂͦ›®ÙÕÛÉÃÍÆ¿ÊšƒrÑÌÔ…t‘·¯¾¨°µ¬¼« ³€nÇÁ̶½²¨¹§ˆx”€o»²À´ª»ˆw“Šy•ËÆÏ¥™¿·Ä¤˜¹±ÀÁºÆ€š¯¥¶ÛØÝÒÍÕÊÄΊz–×ÓÚ±§¸˜‹¢¡”©³©º “©zg‡¾¶Ä½µÃ|i‰ž’¨« ²ËÅφu’“„™‹£›Ž¥‰y•ÐËÓxe…ÕÑØ£µÏÊÒÀ¸ÅÓÏÖ¢–«¸¯¾§œ¯âà㢴¼³ÁmŒ‡v’‘‚œÀ¹Åyf‡¹°¿¯¥·‚pŽwd…”†Ÿ”…žÅ¾É{hˆ•‡ !ù,ÿH° Áƒ*,( ¡Ã‡Hœ8q‚E‹2f|À‘ã•B^ð㇌I'( ¨\Ù¡e 0až9Ó¨Qž<… åخٚ5R‚vvèP95j† Y*HŠ§ÙæÌ•*‰Up%²rrÁÕS¢DÇ´‘Ë Õ;ËZå²ÂÖŽ pAˆ™»‰–‘»oÞÈØ»MR•¿È4Ö0NÜ”Ãæ(V¼g†Çx%ÛA™R @A2+«ô¤3 :§jˆ&'ŽÓ¿zýùs¤õ4H3b?zëÛzô\bÁ»Z: –Ô xñb¢øð¡ÁüÚ³"Ðݸ©õM‚u뻶h7¥H‘¯.àWÿD¤|¨E‹J•Yÿ‰š…÷¼ÉêA_UŸ>ØVèGƒFX”ÿÁÀ€!DÃMÎb†J4È#D!9aT¨Imx¡!)TthI&"„(.\”hŒ+)¤H!#´8Â0nM4VÀ 8vrÃŽ·üà£4: ZéŒHN‚Ä’º ᤠPb2Æ”†Ò•0diË\v™Á— ‚H dÊ! h2È lbáæ pZóÅœ<Ô Æl°ÅžMô‰ÂŸ*(„JÀˆ"êÀ¢‹:âBšF TZ)‑xD ©¦tú zÀÁ¨`ꩨ¦ªêª¬¶êê«°Æ*무Öjë¸æªë®¼öêë¯ÀÞ; Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/#findComment-353817 Share on other sites More sharing options...
jitesh Posted September 24, 2007 Share Posted September 24, 2007 Use following code to download file and set mime content type in header. <?php header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: $ctype"); header('Content-Description: File Transfer'); header("Content-Disposition: attachment; filename=\"".basename($filename)."\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); set_time_limit(0); @readfile("$filename") or die("File not found."); ?> ------------------------------------------------------------------------------------------------ Header Already sent : warning comes when some contents or spaces are printed on brwoser and you are trying to redirect throught header. Quote Link to comment https://forums.phpfreaks.com/topic/70426-unable-to-open-content-in-datbase/#findComment-353820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.