I have a page that allows users to download files stored in a database. This page simply uses a GET variable to find the corresponding ID in the database table and return the file as an attachment in the header of the file.
header("Content-length: $objFile->size");
header("Content-type: $objFile->type");
header("Content-Disposition: attachment; filename=".($objFile->name));
The issue I have is if the file uploaded into the database contains a space in the name, for instance "3 Year Spending Analysis.pdf", then when the file is returned for download the file name comes up as just "3" due to the space in the name.
I've tried urlencode, rawurlencode and others but not getting the expected results of the full file name.