[eluser]RBrowne[/eluser]
I've been trying to use the read_file function of file_helper, which works for the most part. However whenever there is a ( in the filename, the function fails to be able to read the function.
I've checked the allowed chars in the url - not that. Checked the file exists - it does. Tried urlencode/decode/recode and they don't help.
Here's my function for the downloader:
Code:
function index() {
$this->load->helper('download');
$this->load->helper('file');
$aSegs = $this->uri->segment_array();
//print_r($aSegs);
switch ($aSegs[2]) {
case 'po':
$oData = read_file('./pdfs/purchase_orders/' . $aSegs[3]);
break;
case 'inv':
$oData = read_file('./pdfs/invoices/' . $aSegs[3]);
break;
default:
$oData = FALSE;
break;
}
$sName = $aSegs[3];
//print_r($oData);
if ($oData !== FALSE) {
force_download($sName, $oData);
}
}
I've checked that the $aSegs[3] is correct - it is. The example url is: localhost/download/po/Purchase Order 100542 - PR Electronics (UK) Ltd.pdf
Does anyone have any ideas? I don't really want to write a function to strip the brackets out of the naming function, as this would be a pain.
Any help would be greatly appreciated.
Rich