I realized that the $name variable defined in file_get_content_headers (file.inc) is not used in the array returned by the function. I was trying to find out why the files that I downloaded to a private directory were being downloaded with "no name", yet the download uri displayed the name perfectly.
After adding this line to the array of headers returned by the refered function, the download now works perfectly:
'Content-Disposition' => "attachment; filename=\"$name\"",
The function now is like this:
function file_get_content_headers($file) {
$name = mime_header_encode($file->filename);
$type = mime_header_encode($file->filemime);
return array(
'Content-Type' => $type,
'Content-Disposition' => "attachment; filename=\"$name\"",
'Content-Length' => $file->filesize,
'Cache-Control' => 'private',
);
}
Any comments on this are welcome.
Thanks.