Weird problem with download

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • piesse

    #1

    Weird problem with download

    I am experiencing a weird problem with a popular PHP web application
    (Moodle).

    The thing uses a custom function to allow you to download/open a file.
    That function just send a series of header fields (depending on the file
    extension), then outputs the file to the client browser. The result that
    all poeple seems to get is that the file opens in the proper application
    (i.e. .doc files in the wordprocessor, .ppt in powerpoint etc).

    When I try to open a file I also get the proper application to open.
    However, it is unable to read the file.
    It I chose to download the file and look with an hex editor, I find that
    two bytes (0D 0A)are added at the beginning of the file, then all the
    file content is shifted by two bytes, and the last two bytes are missing
    (so that the size remains the same as the original file).

    If I make a copy the file output on the server while it is sent to the
    client, the one copied on the server is correct, while the one arriving
    to the clent is broken as described. So the bug is somewhere after the
    content is sent ...
    I suspect one of the headers, but since I seem to be the only one with
    this problem it could be some PHP setting. What can cause such a behaviour?
    I am using php 4.3.10 under xp and os/2


    thanks
    piesse
Working...