Re: download file

From: Ken (kkrolski_at_wi.rr.com)
Date: 08/25/04


Date: Wed, 25 Aug 2004 04:49:18 -0500

header( "Content-Disposition: attachment;
filename=".$_SESSION['pictures'.$i]);
header( "Content-Type:".$_SESSION['pictures'.$i.'_type']);
header( "Content-length: ".$_SESSION['pictures'.$i.'_size']);
header( "Content-Transfer-Encoding: binary" );
readfile($_SESSION['archive_dir_read'].$_SESSION['pictures'.$i]);

I finally was able to save a file from the internet server to my hard drive
thanks to all the help I received from the newsgroup.

For the next person to ask the question about downloading files, a few
pointers.
We know this but do not remember it.

The headers must be before any writing to the display, including html and
echo.
So basically, add a separate page for the headers.

I do have four other questions.
1. How do I define the hard drive directory for the files in the headers?
        I added it to the filename, then the file name became the page name,
i.e., file.gif became download.gif download.php is the page file name.
header( "Content-Disposition: attachment;
filename=c:/temp/".$_SESSION['pictures'.$i]); The manual says the directory
name cannot be specified. Is that still true? Any work arounds?

2. Can I download multiple files at one time? Can you suggest a script for
handling multiple files?

3. Is there a way to download the files without going through the file
download box? Open the page and the files download to the specified
directory.

4. Do I need any other headers?

Thanks!!

Ken



Relevant Pages

  • Re: [PHP] Multiple File Downloads
    ... I wouldn't think so, Dave, because headers for each file need to ... be sent at the request for download, and headers cannot be sent after ... $header .="More blah blah blah" ... method for multiple files in the response the same way you can send ...
    (php.general)
  • Re: Xnews out of memory problem
    ... Xnews out of memory problem ... I'm faced with a new woe: due to the large amount of headers ... that I need to download (which sometimes number over 10 ... but it seems to me that Xnews makes ...
    (news.software.readers)
  • Re: Problem Updating New Messages from NTTP News Server OE
    ... > as far as I know and he doesn't have a server in his setup. ... download the answer to a problem he had posted in the Outlook group and I had seen the answer almost immediately on July 1. ... sure how taking the check out of the download headers boxes would have helped. ... pane 3) Get headers at a time 4) No check in mark all messages as read when exiting newsgroup ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Server Side filtering (as pertains to Google Groups)
    ... headers are included in the overview headers, ... don't need a proxy to filter on that header). ... The effect is to retrieve bodies only for articles whose headers have ... the user can choose to download it or not. ...
    (news.software.readers)
  • Re: new to ng
    ... > dialog box asking if you want the macro to run, ... downloads email headers ... I don't download any email in Outlook Express ... > first checked out with Magic Mail Monitor, ...
    (microsoft.public.windowsxp.general)