Jump to content

unable to open content in datbase


inspire

Recommended Posts

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ë­¸æªë®¼öêë¯ÀÞ;

 

Link to comment
Share on other sites

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ë­¸æªë®¼öêë¯ÀÞ;

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.