Saving php Arabic file on Windows 7
In php and windows7, like OS file saving as arabic name, it gives like this ... ร'ร ยฑ ร '' โฐ รยบร '. I need to store the filename with only Arabic text.
header("Content-Type:text/html; charset=utf-8");
$name = $_GET['name'];
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ))
{
$filename = $name.".png";
file_put_contents($filename,$GLOBALS[ 'HTTP_RAW_POST_DATA' ]);
}
Please help me.
Thank.
+3
source to share
1 answer
Try the following:
header("Content-Type:text/html; charset=utf-8");
$name = $_GET['name'];
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ))
{
$encoding = mb_detect_encoding($name);
$filename = iconv($encoding, "UTF-8", $name.".png");
file_put_contents($filename,$GLOBALS[ 'HTTP_RAW_POST_DATA' ]);
}
+4
source to share