I have a classic php script for saving tmp files:
$uploads_dir = "scans";
var_dump( $_FILES );
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
rename($tmp_name, urldecode("/var/www/html/$uploads_dir/$name") );
}
}
echo urldecode("/var/www/html/$uploads_dir/$name");
However, the file 'фавикон.png' gets saved as 'фавикон.png'. Please help me out what to do with encoding.
Thank you
EDIT:
Got it working with iconv function. However, for some weird reason it had to be encoded into windows format.
The resulting code:
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
$name =iconv('UTF-8','windows-1251', $name);
copy($tmp_name, "/var/www/html/$uploads_dir/$name");
}