php5 Header Error For Downloading

Discussion in 'PHP' started by romeo2010, Apr 11, 2008.

  1. #1
    i am trying to force download with this but it give me error i don't know why


    <?php
    
    $url='http://www.zshare.net/video/'.$_GET['video'].'/';
    $linkdown=$url;
    
    
    // Headers for an download:
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="$linkdown"'); 
    header('Content-Transfer-Encoding: binary');
    
    ?> 
    PHP:

     
    romeo2010, Apr 11, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Is there a space or newline before your "<?php" tag? I say this because the first error is on line 9, but your first header command is on line 8, therefore I think your script has been moved down a line by a newline character. This means that a blank line is being outputted to the browser; then you have tried to send the headers. If there is one, please try removing it.

    Jay
     
    jayshah, Apr 11, 2008 IP