Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload file that have arabic name

Tags:

php

upload

arabic

I am trying to upload file that have Arabic name like (مرحبا بكم), but when I upload it to server the string is not correct, it shows characters like that (ريÙ-Ù).

So, how can I upload files and keep the correct Arabic name?

<form action="up.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"];
  }
?>
like image 553
user3056538 Avatar asked Nov 11 '22 16:11

user3056538


1 Answers

I would enable unicode (utf8) in the both the web page and the filesystem.

like image 146
Osama Al-Maadeed Avatar answered Nov 15 '22 07:11

Osama Al-Maadeed