I have a problem that I'm using move_uploaded_file()
function to upload files and some of the files named in Arabic so I googled the problem but still no answer I used meta tag and I used Base64 encode and everything but still doesn't work.
What is the solution ?
<?php
$data_name=$_POST['name'];
$name=base64_encode($_FILES['file']['name']);
$location="../Files/".$course_name."/";
$tmp_name=$_FILES['file']['tmp_name'];
if(move_uploaded_file($tmp_name, $location.$name))
echo"OK";
?>
One solution can be:
Have a database where save your arabic name of file and give that file some custom unique name with current time, also save custom name into db, at time of retreival change file name and show to user.
OR use some name conversion library which convert text from arabic to englidh and vice versa. for this purpose have a look on these refferences
how to convert english into arabic dynamically
convert Persian/Arabic numbers to English numbers
OR convert string into utf-8 using php for help:
PHP: Convert any string to UTF-8 without knowing the original character set, or at least try
http://php.net/manual/en/function.utf8-encode.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With