When I created a download script a couple weeks ago I used
readfile($filename) instead of fread() and didn't get anything like what
you're getting.
[snippet]
header("Content-type: $type");
header('Content-Disposition: attachment; filename="'.$file_name.'"');
readfile($dfile);
[/snippet]
NOTE: $dfile = path + file;
--
-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Aaron Todd" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've created a download script that works quite nicely. The only issue
with
> it is that when I download a file where the file name is like "filename
> v1.0.2.1.exe" there is some extra characters added into the name when it
is
> downloaded. So that file will be "filename v1[1].0.2.1.exe". I am
> wondering if this is my headers that are doing this, but I really dont
know.
>
> Here is my code:
> <?php
> $file = $_GET['file'];
> $path = $_GET['type'];
> $rootpath = "/home/virtual/site341/fst/var/www/downloads/";
> $filename = "$rootpath$path/$file";
> if (file_exists($filename)) {
> header("Content-Description: File Transfer");
> header("Pragma: no-cache");
> header("Content-Type: application/force-download");
> header("Content-Disposition: attachment;
filename=".basename($filename));
> header("Content-Length: ".filesize($filename));
> $handle = fopen(($filename), "r");
> print(fread($handle, filesize($filename)));
> flush();
> fclose($handle);
> } else {
> header("HTTP/1.0 404 Not Found");
> }
> ?>
> If anyone can let me know what is going on I'd appreciate it.
>
> Thanks,
>
> Aaron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php