I have the following piece of code to parse a csv file. After that I am displaying it. The .csv file is displaying perfectly on my local machine but on the server after clicking on upload a blank page is displaying.
function uploadTrainees()
{
$csv = array();
$tmpName = $_FILES['csv']['tmp_name'];
//echo $tmpName;
//ini_set('auto_detect_line_endings',true);
$fp = fopen($tmpName,'r');
$fields = array('delegate_title', 'delegate_firstname', 'delegate_lastname', 'delegate_jobtitle', 'delegate_email', 'delegate_phone', 'is_bringing_own_laptop');
$records = array();
while ($record = fgetcsv($fp,1000,','))
{
$records[] = array_combine($fields, $record);
}
fclose($fp);
}
Help me to solve this issue.
What version of PHP is the live server running?
The function
array_combine()is only in PHP5Edit
There is a function here to do this – http://snipplr.com/view/4918/arraycombine-for-php4/