Re: Characters in an uploaded text file being corrupted
| From: | Jacob Kruger | Date: | Sun, 27 May 2012 09:49:42 +0000 |
| Subject: | Re: Characters in an uploaded text file being corrupted | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30890@lists.php.net to get a copy of this message | ||
Ok, and, FWIW, this test text file is a word document that have saved as a text file, and when now resaved it using specifically unicode encoding, it seemd to eliminate this issue, but would have thought there might be a relatively simple way to handle something like encoding conversion in PHP itself..?
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message ----- From: "Jacob Kruger" <jacobk@mailzone.co.za>
To: <php-windows@lists.php.net>
Sent: Sunday, May 27, 2012 11:22 AM
Subject: [PHP-WIN] Characters in an uploaded text file being corrupted
Using the following bit of code, I am then saving the contents of an uploaded text file into a mysql database, but, the issue seems to be that immediately after retrieving the contents of the temporary path of the uploaded file, for example, things like ' characters are rendering as ? characters in the assigned variable..?
//start of code segment
if (isset($_FILES["filContent"])) {
if ($_FILES["filContent"]["type"] == "text/plain") {
$ltContents = file_get_contents($_FILES["filContent"]["tmp_name"]);
}
}
//end of code segment
I am guessing that it's either due to something to do with upload part of process - form tag is using post method, and has enctype set to multipart/form-data - or else, it might have something to do with the server handling character encoding or something..?
This is currently being run/tested under WAMP, on a windows7 64 bit machine, FWIW.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'