Re: [PHP] file redirect?

2002-02-10 Thread Bogdan Stancescu

Ah, didn't know you also serve remote files. In this case Philip's solution makes
much more sense - otherwise you'll have to download the file on the server side and
upload it to the client, which is way too much fuss to worth it.

Bogdan

Ed Lazor wrote:

> At 12:58 AM 2/11/2002 +0200, Bogdan Stancescu wrote:
> >Well, you have to send the actual file - otherwise the result of a zero-length
> >file is not surprising at all.
>
> That makes sense.  I thought the last line was doing that.  How would I do
> it in a way that works for local and remote files?
>
> > > $content_type = "Content-type:  application/zip";
> > > header($content_type);
> > > header("Content-disposition: filename=".$filename);
> > > header($destination);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] file redirect?

2002-02-10 Thread Ed Lazor

At 12:58 AM 2/11/2002 +0200, Bogdan Stancescu wrote:
>Well, you have to send the actual file - otherwise the result of a zero-length
>file is not surprising at all.

That makes sense.  I thought the last line was doing that.  How would I do 
it in a way that works for local and remote files?


> > $content_type = "Content-type:  application/zip";
> > header($content_type);
> > header("Content-disposition: filename=".$filename);
> > header($destination);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] file redirect?

2002-02-10 Thread Philip J. Newman

   what about this?



> http://server/download.php?url_to=/myfile.zip

check out

http://www.philipsdomain.com/hyperlinks/  for a redirect sample.


- Original Message -
From: "Ed Lazor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 11, 2002 11:30 AM
Subject: [PHP] file redirect?


> I'm trying to figure something out and thought I'd see if you guys have
any
> ideas.
>
> The goal:  tracking the number of downloads for files on the server.
>
> The approach:  routing file downloads through /download.php like this:
> http://server/download.php?target=/myfile.zip
>
> What I tried that worked was using javascript to launch download.php in a
> new window and use a meta tag to redirect to the file in question, like
this:
>
> print "";
>
> This works, but it's really slow, because it usually takes a while to open
> a new browser window.
>
> I found another approach, but couldn't get it to work:
>
> $content_type = "Content-type:  application/zip";
> header($content_type);
> header("Content-disposition: filename=".$filename);
> header($destination);
>
> It seemed I got close at one point... it would open a File Save window,
but
> the file would end up as 0 bytes in size.
>
> My preference is using the second approach if I can get it working,
because
> it's much faster than opening a new browser window.  Any ideas of how to
> make it work?
>
> Thanks,
>
> -Ed
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] file redirect?

2002-02-10 Thread Bogdan Stancescu

Well, you have to send the actual file - otherwise the result of a zero-length
file is not surprising at all.

Bogdan

Ed Lazor wrote:

> I'm trying to figure something out and thought I'd see if you guys have any
> ideas.
>
> The goal:  tracking the number of downloads for files on the server.
>
> The approach:  routing file downloads through /download.php like this:
> http://server/download.php?target=/myfile.zip
>
> What I tried that worked was using javascript to launch download.php in a
> new window and use a meta tag to redirect to the file in question, like this:
>
> print "";
>
> This works, but it's really slow, because it usually takes a while to open
> a new browser window.
>
> I found another approach, but couldn't get it to work:
>
> $content_type = "Content-type:  application/zip";
> header($content_type);
> header("Content-disposition: filename=".$filename);
> header($destination);
>
> It seemed I got close at one point... it would open a File Save window, but
> the file would end up as 0 bytes in size.
>
> My preference is using the second approach if I can get it working, because
> it's much faster than opening a new browser window.  Any ideas of how to
> make it work?
>
> Thanks,
>
> -Ed
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] file redirect?

2002-02-10 Thread Ed Lazor

I'm trying to figure something out and thought I'd see if you guys have any 
ideas.

The goal:  tracking the number of downloads for files on the server.

The approach:  routing file downloads through /download.php like this:
http://server/download.php?target=/myfile.zip

What I tried that worked was using javascript to launch download.php in a 
new window and use a meta tag to redirect to the file in question, like this:

print "";

This works, but it's really slow, because it usually takes a while to open 
a new browser window.

I found another approach, but couldn't get it to work:

$content_type = "Content-type:  application/zip";
header($content_type);
header("Content-disposition: filename=".$filename);
header($destination);

It seemed I got close at one point... it would open a File Save window, but 
the file would end up as 0 bytes in size.

My preference is using the second approach if I can get it working, because 
it's much faster than opening a new browser window.  Any ideas of how to 
make it work?

Thanks,

-Ed



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php