RE: [PHP] Re: file downloads (again)

From: Date: Mon, 17 Jun 2002 11:25:10 +0000
Subject: RE: [PHP] Re: file downloads (again)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102493@lists.php.net to get a copy of this message
No, the HTML and attachment are sent separately. They probably use a meta-refresh, written dynamically with PHP, to redirect to you the download page that send the file. i.e. you'll go to download.php and view the html that says your download will begin shortly. Meta-refresh will redirect you to download-file.php?file=whatever or something, which sends the application header and uses passthru() to send the file. Yeah, it 'looks' like you only go to one page, but it's actually two. There is a way to do it with multi-part headers and dividing the data up, but I'm not familiar with it. This topic is discussed a lot on here, search the archives. ---John Holmes... > -----Original Message----- > From: Justin French [mailto:justin@indent.com.au] > Sent: Monday, June 17, 2002 6:50 AM > To: holmes072000@charter.net; php > Subject: [PHP] Re: file downloads (again) > > Hi John, > > Thanks for the reply. > > I'd say the lack of passthru() was one of my many problems :) > > I don't have access to dirs outside the web root, but I do have the > ability > to add .htaccess files, so I'll be able to refuse direct requests to the > files. > > > The fact that I can't send the file as an "attachment" WHILE sending the > HTML page puzzles me a bit, because *exactly that* happens on > download.com... > > You click on "download now", and you get a new HTML page, and a compressed > file comes through to you with a download window about 1-3 seconds later. > > > Maybe it's the compressed file that's the key???? > > > Thanks, > > Justin French > > > > > > > > on 17/06/02 6:52 PM, John Holmes (holmes072000@charter.net) wrote: > > > You're sending a application/octet-stream header and an HTML header at > > the same time... I don't see where your sending any file data, but > > that's just a snippet of code, though. In order to send the file to the > > browser, you have to set the application/octet-stream header, then do > > something like passthru($filename). That's it. You can't do that and > > HTML at the same time, though. > > > > Also note that if you're storing your mp3 inside of your web directory, > > anyone can just type in the URL to it and download whatever they want. > > You should be storing them outside of the web root. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#102493) next »