A strange problem is that the rename file is incorrect. please refer to the code below:
$ Uploadfile = $ uploaddir. basename ($ _ FILES ['music'] ['name']);
$ Musicname = basename ($ _ FILES ['music'] ['name']);
If (move_uploaded_file ($ _ FILES ['music'] ['tmp _ name'], $ uploadfile )){
$ Md5string = md5_file ($ uploadfile );
If (stripos ($ uploadfile, ". mp3 ")! = False)
{
$ Filename2 = "/data/www/html/song/upload/m /". $ subdir. "/". $ userid. "/". $ userid. "_". $ md5string. ". mp3 ";
If (file_exists ($ filename2 ))
{
Unlink ($ uploadfile );
}
Else
{
If (rename ($ uploadfile, $ filename2 ))
{
}
Else
{
}
}
}
The error file on the server is as follows (more ~) :
Have you ever encountered a similar problem?
Reply to discussion (solution)
Why is the name not directly named in the second parameter of move_uploaded_file? Instead, you have to rename it after the upload is successful?
Because after the file is uploaded to the server, calculate the md5 value and rename it