0

I am trying to upload a file that has an Arabic name like (مرحبا بكم)

But when I upload it to server the name is not correct, it shows characters like that (ريÙ-Ù).

So, how can I upload files with Arabic name?

Code:

<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>

PHP File:

<?php
if ($_FILES["file"]["error"] > 0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "<br>";
    }
else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    echo "Type: " . $_FILES["file"]["type"] . "<br>";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
?>
Tom Zych
  • 13,329
  • 9
  • 36
  • 53
user3056538
  • 73
  • 1
  • 4

1 Answers1

0

you have to encode the name in unicode. you could use base64_encode($filename) to save the name of the file

NULL
  • 1,848
  • 1
  • 21
  • 23
FA5er
  • 1
  • 3