Ross wrote: > On this page > http://www.nationalservicesscotland.com/publications/a-z.php > > I use the following code to donwload binary data. It is jsut gibberish. I > think the offending line is echo "<a class=\"pdflinks\" > href=\"$link\"</a>$name</span>"; > Seeing as you are echoing a simple html anchor, I can see no reason why the pdfs don't download in the correct fashion. Have you tried - just for testing purposes - trying it in HTML to see if it downloads? If that does not work it could be that your server is sending the wrong MIME type. You have a few typos in the html by the way, which can't be helping ... <a class=\"pdflinks\"> href=\"$link\"</a>$name</span> should be <span><a class\"pdflinks\" href=\"$link\">$name</a></span> I doubt it will work as you have it here. You can also use something like this to open files requested in a form, to avoid HTML altogether. For the sake of full disclosure, a friend wrote this PHP, not me, but it works! if(isset($_POST["openfile"])) //filename choice passed from HTML form { $openfile = $_POST["openfile"]; $pdf = "/path/to/pdfs/$openfile"; // the pdf to use $newname = basename($pdf); // remove the directories $size = filesize($pdf); // get the size of the file header("Content-Length: $size"); // send the size header("Content-Type: application/pdf"); // mime type header("Content-Disposition: attachment; filename=$newname"); // force //download as newname readfile($pdf); // output file } The file will be downloaded without the user seeing the location. BMA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php