Problems with readfile

Hi guys

I’m using the readfile() function and I seem to be having problems opening files with spaces in their name. Lots of these files exist, so I don’t really want to rename every one of them.

Is there a way around this??

Here’s the code I’m using


    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;

Thanks in advance guys

Crabby

http://www.php.net/manual/en/function.fread.php#52038

Maybe this is the answer

Perfect thank you guido2004!!

Jees, I need to improve my Google Searches :slight_smile: