Another PHP download question

Discussion in 'OT Technology' started by k2737, Jan 10, 2006.

  1. k2737

    k2737 Active Member

    Joined:
    Nov 29, 2004
    Messages:
    3,324
    Likes Received:
    0
    Location:
    Ft Lauderdale
    When attempting to download a file that has been uploaded it seems that two sets of html tags are being appended to the top of the files (can be seen in text files). Images won't open and it seems like it isn't bothering the other file types. Now images will probably never be uploaded to this site but I want it to work just incase. Any ideas on why the html tags would be getting appended to the file? The only thing I can think of is because I am using outputbuffering. Could this be the issue? My download code is as follows....

    PHP:
    header ("Content-Length: $size");
    header ("Content-Type: application/force-download");
    header ("Content-Disposition: attachment; filename=$filename");
     
    readfile($filePath);
    exit;

    Also I know the files are being uploaded correctly cause if I pull the file down manually off the server they are fine. Any ideas?
     
  2. k2737

    k2737 Active Member

    Joined:
    Nov 29, 2004
    Messages:
    3,324
    Likes Received:
    0
    Location:
    Ft Lauderdale
    Yup that was the problem. All fixed now. :coold:
     
  3. kYd

    kYd New Member

    Joined:
    Dec 31, 2005
    Messages:
    5,881
    Likes Received:
    0
    Location:
    England, Nottingham
  4. k2737

    k2737 Active Member

    Joined:
    Nov 29, 2004
    Messages:
    3,324
    Likes Received:
    0
    Location:
    Ft Lauderdale
    Meh, this is the first time I have used PHP. I know now that there are problems with using OB but it was a quick fix to some problems i had when I started.
     

Share This Page