image not displaying

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • image not displaying

    hello

    when i try to upload a image then it moves to the directory where i want. but the image does not shows up.what is the problem with this code. i get error

    Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/database.php:47) in /home/mysite/public_html/sharefile.php on line 13

    PHP Code:
    <?php
    include("database.php");
    include(
    "function.php");
    connectdb();

    $fileid mysql_real_escape_string ($_GET["fileid"]);
    $sid mysql_real_escape_string ($_GET["sid"]);
        
    $file mysql_fetch_array(mysql_query("SELECT filename, touid FROM fileshare WHERE id=$fileid"));
        
    $uid mysql_fetch_array(mysql_query("SELECT uid FROM session WHERE id='".$sid."'"));
            
    $uid $uid[0];

        if (
    $file[1] == $uid){
        
    header("Location: fileshare/".$file[0]);



        }
        else{
            
    header("Content-type: text/html");
            echo 
    "<html><p>This file is not yours!<br/><a href="index.php?action=main&amp;sid=$sid">Home</a></p></html>";
        }
    ?>



    i also defined destination folder with variable in database.php where file image should be moved. file gets move in destination folder but image is not displaying when user tries to download the image. and user gets error msg

    Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/database.php:47) in/home/mysite/public_html/sharefile.php on line 13




    Last edited by thunderwap; 15.04.16, 07:49.

  • #2
    Remove the output (html) in database.php

    The function header() must come before all html

    Comment


    • #3
      Originally posted by something else View Post
      Remove the output (html) in database.php

      The function header() must come before all html
      there is no html output in database.php there is only variables defined between

      PHP Code:
      <?php  

      ?>

      the problem is fixed.my mistake was that i leaved blank space after ?>

      so this maked me problem.my whole day was passed yesterday to solve this problem but today in morning it solved. i forgot to check the blank lines or space in database.php

      thank you so much.
      Last edited by thunderwap; 16.04.16, 04:50.

      Comment


      • #4
        Originally posted by thunderwap View Post
        there is no html output in database.php there is only variables defined between

        PHP Code:
        <?php

        ?>

        the problem is fixed.my mistake was that i leaved blank space after ?>

        so this maked me problem.my whole day was passed yesterday to solve this problem but today in morning it solved. i forgot to check the blank lines or space in database.php

        thank you so much.

        Sweet man, well done!

        Comment

        Working...
        X