Mac issue when Saving excel and importing into phpExcel

Topics: User Forum
Oct 15, 2009 at 12:48 AM

I am making a excel spreadsheet uploader using phpExcel and noticed an issue when allowing people to upload Excel files saved in Mac Excel. (has to do with UTF-8).

This line:

$objPHPExcel = $objReader->load($_FILES['uploaded']['name']);

needs to be

$objPHPExcel = $objReader->load(utf8_encode($_FILES['uploaded']['name']));


Yuck but there ya go.

Oct 15, 2009 at 1:36 PM
Edited Oct 15, 2009 at 1:38 PM

Thanks for your note, but do you mean there are problems with Excel files uploaded from Mac, or Excel files created in Mac and uploaded from any platform?

If you just need to read the Excel file, then can you not base your script on


instead of


If you are trying to obtain the original file name then you must ask what encoding is used for $_FILES["uploaded"]["name"]. This entry is controlled by the browser from which the file was uploaded. As far as I remember from my tests, it will be encoded using the particular state of encoding the page is viewed when the form is submitted. But this should be tested across various browser on various platforms.

This means that you will want to set the appropriate encoding for the HTML page holding the form with the file select field

header('Content-Type: text/html; charset=UTF-8')
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Did you do that? Otherwise it will not be UTF-8 encoded which is what you want.


Oct 15, 2009 at 4:22 PM
yeap that worked just fine. I had a page that had no content Type as it was actually doing no rendering of  any kind (just processing)

oh and the Excel files were being saved out from Mac Excel and they can upload these to a db directly.