please help me!
I'm trying to create website with simple form. User will have an opportunity to send a photo via form. The problem is that when I'm trying to put image by using AJAX and PHP to pre-created folder, and to modify the name of file with gmdate() function it creates the file with unknown signs. Here is the example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
</head>
...
<body>
<form id="data" method="POST" action='' enctype="multipart/form-data">
...
<input type="file" name="foto" id="foto" placeholder="Фотография" accept="image/*" required/>
...
</body>
And here is my PHP file, that receives photo:
header('Content-Type: text/html; charset=utf-8');
...
move_uploaded_file($_FILES['foto']['tmp_name'], "img/". gmdate('H_i_s_', time()+3*3600) . $_FILES['foto']['name']);
But when I send the file with cyrillic name(for example 'я иду на работу.jpg'), it puts the wrong name ('16_54_31_СЏ РЅР° работуI.jpg'). I understand that the problem is related to encoding, but what should I do?? I checked by developers tool in browser, that name of file goes correctly to PHP