Ec (2); php is made by foreigners. It is not perfect in some aspects of Chinese support, so we found that Chinese uploading was not successful, let's take a look at the instance and solution. * $ Filepathupfile; if ($ _ FILES [file] [error] 0) {& nbsp; if (move_uploaded_file ($ _ FILES [fi script ec (2); script
Php is made by foreigners. It is not perfect in some aspects of Chinese support, so we can find that Chinese uploading fails,
Let's take a look at the instance and solution.
*/
$ Filepath = 'upfile /';
If ($ _ FILES ['file'] ['error'] = 0)
{
If (move_uploaded_file ($ _ FILES ['file'] ['tmp _ name'], $ filepath. $ _ FILES ['file'] ['name'])
{
Echo 'file uploaded successfully ';
}
Else
{
Echo 'file Upload Failed ';
}
}
/*
.....
The above is a simple file upload code. It is okay to transfer the English language, but the Chinese language won't succeed. Well, how can we deal with the problem of failed uploading of Chinese file names.
The simple method is to rename the uploaded file name and then click OK. Next we will modify the program. As follows.
*/
If ($ _ FILES ['file'] ['error'] = 0 ){
$ Ext = end (explode ('.', $ _ FILES ['file'] ['name']);
$ FileRandName = time (); // generate a string based on the current time
If (move_uploaded_file ($ _ FILES ['file'] ['tmp _ name'], $ filepath. $ fileRandName. '.'. $ ext ))
{
Echo 'file uploaded successfully ';
}
Else
{
Echo 'file Upload Failed ';
}
}
// No matter what file you upload, it is OK.
// The original article on this site is reprinted to indicate that it is from www.111cn.net