Characters in an uploaded text file being corrupted
| From: | Jacob Kruger | Date: | Sun, 27 May 2012 09:22:30 +0000 |
| Subject: | Characters in an uploaded text file being corrupted | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-30889@lists.php.net to get a copy of this message | ||
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...'