I am having some trouble making it possible to download a file using the
header function.  The problems are: (1) I get the dialog box to download the
file, but for some reason the type of file isn't getting passed to the box,
and (2) when I download a 4MB file it only seems to be getting 16.6KB.

I haven't used header for this purpose before this, so maybe I am missing
something.  I Googled around and found the content-disposition type I
thought I needed, I actually tried 3 different types (the file is a
compressed zip file).  I Googled around for tutorials on downloading files
and still haven't found the answer to correcting my problem.  Here is the
code I am using, maybe a couple more trained eyes looking at this could help
me out.

<?php
    $download = 'http://www.usa-financial.com'.urldecode( $_GET['link'] );
    $type = urldecode( $_GET['type'] );
    $size = filesize( '/home2/www/usa-financial'.urldecode(
$_GET['link'] ) );
    header("Content-type: $type");
    header("Content-Disposition: attachment; filename=$download;");
    header("Accept-Ranges: bytes");
    header("Content-Length: $size");

    echo "<!-- $type \n $size \n $download \n -->\n";
?>

Josh

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

Reply via email to