Can't save my files in Arabic Laravel

Viewed 894

My App is getting an attribute from database in arabic language, when i'm trying to save my file and rename it according to this attribute i'm getting these characters (سين2مبني ب) instead of (مبني ب) however, when i try to print it, the result is (مبني ب) not (سين2مبني ب) Here is my code for saving the file:

    $project = Project::find(1);; //Model Project
    $destinationPath = 'ProjectPictures/' .$project->name . '/';//the name attribute is in arabic 
    $file =$request->file('image'); //image to be saved in arabic named directory
    $file->move($destinationPath, 'image.jpg');

I'm using utf8_general_ci for the table collation and utf8 for default charset, phpmyadmin, and im using Windows 8 for my OS

2 Answers

use iconv function

عن تجربة اتحدث ونحلت معي

$fileName=iconv('utf-8','windows-1256', $file->getClientOriginalName());
$file->storeAs("images/"), $fileName);

ادعيلي

Related