I
I
IvanOne2014-01-30 23:20:40
PHP
IvanOne, 2014-01-30 23:20:40

Why can't upload files?

move_uploaded_file($_FILES['reg']['tmp_name'], "".$_SERVER['DOCUMENT_ROOT']."/тест/".$_FILES['reg']['name']."");

I'm trying to upload a file to the server in the test folder in this way, which results in:
Warning: move_uploaded_file(E:/OpenServer/domains/download/test/4.jpg): failed to open stream: No such file or directory in E:\OpenServer \domains\download\download.php on line 10
Warning: move_uploaded_file(): Unable to move 'E:\OpenServer\userdata\temp\phpAAFB.tmp' to 'E:/OpenServer/domains/download/test/4.jpg ' in E:\OpenServer\domains\download\download.php on line 10
Guess what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Smilley, 2014-01-30
@Smilley

Maybe because of the Russian letters an error?

N
Nazar Mokrinsky, 2014-01-30
@nazarpc

The file system in Windows works with windows-1251 encoding, but the whole world has been successfully using utf-8 in websites for a long time, and you probably do too.
So either remove Cyrillic from the file system, or use iconv() to convert the path from utf-8 to windows-1251.
PS Either switch to Linux, where PHP does not do such a disgrace, since everything works in the same encoding (most likely).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question