SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    downloading in IE

    I am try to have it download a file. It works in NN however in IE I get a screen full of letters/numbers/symbols and such. Is there something I need to do differently for IE?

    MY Code:
    PHP Code:
    <?
    $pathtosoftware
    ='filename.zip';
    header("Cache-control: private");
    header("Content-type: application/octet-stream");
    Header "Content-Length: ".filesize($pathtosoftware)); 
    Header "Content-Disposition: attachment; filename=$pathtosoftware"); 
    readfile($pathtosoftware);  
     
    ?>
    Any ideas?

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry everbody I opened a new browser window and tried it and i got the download box. What a waste of time the past 1/2 has been

    Anyways thanks again.

    Quote Originally Posted by Wbmstr84
    I am try to have it download a file. It works in NN however in IE I get a screen full of letters/numbers/symbols and such. Is there something I need to do differently for IE?

    MY Code:
    PHP Code:
    <?
    $pathtosoftware
    ='filename.zip';
    header("Cache-control: private" );
    header("Content-type: application/octet-stream" );
    Header "Content-Length: ".filesize($pathtosoftware)); 
    Header "Content-Disposition: attachment; filename=$pathtosoftware); 
    readfile($pathtosoftware); 

    ?>
    Any ideas?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Wbmstr84
    I am try to have it download a file. It works in NN however in IE I get a screen full of letters/numbers/symbols and such. Is there something I need to do differently for IE?

    MY Code:
    PHP Code:
    <?
    $pathtosoftware
    ='filename.zip';
    header("Cache-control: private");
    header("Content-type: application/octet-stream");
    Header "Content-Length: ".filesize($pathtosoftware)); 
    Header "Content-Disposition: attachment; filename=$pathtosoftware"); 
    readfile($pathtosoftware);  
     
    ?>
    Any ideas?
    I had a look here: http://www.php.net/manual/en/function.header.php

    I found this info - not sure if it's the problem that you are having, but sounds likely:

    If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
    PHP Code:
    <?php
    // We'll be outputting a PDF
    header("Content-type: application/pdf");

    // It will be called downloaded.pdf
    header("Content-Disposition: attachment; filename=downloaded.pdf");

    // The PDF source is in original.pdf
    readfile('original.pdf');
    ?>
    Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later.

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Wbmstr84
    Sorry everbody I opened a new browser window and tried it and i got the download box. What a waste of time the past 1/2 has been

    Anyways thanks again.
    Just out of curiosity, did you alter your code? Did you use a more recent version of IE?

  5. #5
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by peDey
    Just out of curiosity, did you alter your code? Did you use a more recent version of IE?
    I just closed the current window opened another one and i got the download box. previously i just saved the file and hit refresh and that wasnt doing it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •