I'm trying to make a website where you can upload flash .swf files. It works great and all except whenever a user uploads a flash file name with japanese or any other asian characters (tested with Japanese characters) it gives me the name wrong.
So this is the file:
Before it starts moving the file im putting the information in the database.
Database:
flash_id | flash_name | not relevant | flash_size | flash_date
After putting the flashes information in the database I move the file from the tmp folder to another folder where I store the uploads.
If you compare the file names from the first 2 pictures with the third one you can see it isn't the same.
Here is the code:
The variables map, filename and ext below are the values that were used in the moving process.
$map = 62;
$filename = $_FILES['upfile']['name'];
$ext = swf;
$str = "../uploads/$map/$filename.$ext";
if (!move_uploaded_file(
$_FILES['upfile']['tmp_name'],
//sprintf('../uploads/%s/%s.%s',$map,$filename,$ext)
$str
)) {
// Failed to move uploaded file.
throw new RuntimeException(4);
} else {
try {
$insq = $pdo->prepare('INSERT INTO flashes (flash_name, flash_size) VALUES (?,?)');
$insq->bindParam(1, $filename);
$insq->bindParam(2, $filesize);
$insq->execute();
} catch (PDOException $ex) {
throw new RuntimeException(999);
}
}
// File is uploaded successfully.
echo 10;