SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I'm trying to make my PHP script hide the location of a file and send the file through it instead of giving away the URL to the user. Here's my code:
    Code:
          $filename = "test.zip";
          $realname = "0123test.zip";
          $fullpath = "C:/nusphere/apache/htdocs/0123/" . $realname;
          header("Content-Type: application/download");
          header("Content-Disposition: attachment; filename=\"$filename\"");
          set_time_limit(0);
          $fn=fopen("$fullpath" , "r");
          fpassthru($fn);
          exit;
    That code works just fine in Opera, but when I try to download in IE, it claims it can't find the file. Can anyone help? Thanks.

    EDIT: Also, that code appears to work just great when it's in a file by itself, but when I call it via script.php?var=abc etc.., it doesn't work.
    Last edited by dcsonic2k; Mar 24, 2001 at 01:49.


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
  •