Hi there,
I am working on a file upload system. The system is working fine. When i upload a file with special characters such as french accent. The system upload the file but it is unable to keep the original characters. All accent are showing some crazy numbers. below the upload.php code i am using. Does anybody know how to allow special characters or what needs to be.
<?php
error_reporting(0);
if (isset($POST["PHPSESSID"])) {
session_id($POST["PHPSESSID"]);
}
session_start();
if (!$_SESSION["loggedin"]) { die("You need to be logged in!"); }
include("conf/database.php");
if ($SESSION["admin"] == "1") { $username = "admin"; } else { $username = $SESSION[username]; }
$extension1 = pathinfo($_FILES['Filedata']['name']);
$extension = $extension1["extension"];
$fileName = $FILES['Filedata']['name'];
$tmpName = $FILES['Filedata']['tmp_name'];
$fileSize = $FILES['Filedata']['size'];
$fileType = $FILES['Filedata']['type'];
echo $fileName. '<br />';
$uploadfile = "./files/".$fileName;
move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile);
$Title = $fileName;
$description='file';
$To = $SESSION['upload_to'];
$pid = $SESSION['upload_pid'];
mysql_connect($dbhost, $dbusername, $dbpassword) or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());
$sql = "select id from filetransfer ORDER BY id DESC";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$id = $row["id"]+1;
$time = time();
$sql = "INSERT INTO filetransfer (id,from, to, title, description, location, locked, time,pid) VALUES
('$id','$username', '$To', '$Title', '$Description', '$uploadfile', '0', '$time' , '$pid')";
echo $sql;
$result = mysql_query($sql);
?>