M
M
mapatka2016-03-07 01:10:04
PHP
mapatka, 2016-03-07 01:10:04

How to specify a file name in Cyrillic and an address in PHP?

Good time!
I download files using PHP from the site. Tell me, please:
1. Now I fold like this

$ble=realpath(__DIR__)."\\"."temp"."\\".$title;
file_put_contents($ble, $file);
Naturally, it saves to the folder with the script. How to specify the address C:\temp\1 for example?
2. I get $title as a title with an extension. If the name is in Cyrillic, then the name is saved in krakozyabry type
R"R"SJ RIRёRSP°
There is a problem with the encoding, how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2016-03-07
@OnYourLips

The script will then work for you on Linux, and there will be no problems with encodings, no additional steps need to be taken. But this is the wrong approach.
When saving files, just change the names.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question