Php uploads the file move_uploaded_file to the apache server running in Linux.
Is to implement the HLS protocol to play audio:
Upload a. m3u8 and 1.tsin 10 seconds. Upload a. m3u8 and 2.ts,... a. m3u8, 3. ts... in this loop.
When I didn't open the player client, everything was normal for file upload, and it was okay for a long time.
When I open the player to play these files, that is, when I access the. m3u8 file.
At this time, the upload of a. m3u8 fails, but the upload of other files is normal. that is to say, all files except a. m3u8 file can be uploaded.
The code for receiving files on the php page is roughly as follows:
$ Temp_name = $ _ FILES ['upfile'] ['tmp _ name'];
$ File_name = $ _ FILES ['upfile'] ['name'];
$ File_name = str_replace ("\", "", $ file_name );
$ File_name = str_replace ("'", "", $ file_name );
$ File_path = $ upload_dir. $ file_name;
// Check the file name
If ($ file_name = ""){
$ Message = "Invalid File Name Specified ";
Return $ message;
}
$ Result = move_uploaded_file ($ temp_name, $ file_path );
If (! Chmod ($ file_path, 0755 ))
$ Message = "change permission to 755 failed .";
Else
$ Message = ($ result )? "$ File_name uploaded successfully.": "Somthing is wrong with uploading a file .";
When the upload fails, the message content is "change permission to 755 failed ."
I analyzed that the result content is empty, indicating that the move_uploaded_file function fails to be executed.
The original directory contains a. m3u8 file. when the upload fails, the. m3u8 file in the directory disappears.
Dear friends, can you help your younger brother to see if this is a problem?
Is it because of permission issues? Because a. m3u8 is being accessed, cannot I replace it with move?
Or is it because of other Shenma problems.
Please give me some advice!
Thank you !!!
Reply to discussion (solution)
Open the php error prompt.
Ini_set ("display_errors", 1 );
Error_reporting (E_ALL );
The most likely cause is that the target folder of move_uploaded_file does not have the write permission.
Open the php error prompt.
Ini_set ("display_errors", 1 );
Error_reporting (E_ALL );
The most likely cause is that the target folder of move_uploaded_file does not have the write permission.
Thank you for your answer!
Because the server is not something I can use for control, the php error prompt prompts that this method can only be used tomorrow.
However, when no client is accessing the target file of move_uploaded_file, everything is normal.
When a client accesses this file, move_uploaded_file fails, and the target file of move_uploaded_file exists. if the file fails, it will not be deleted.
Don't you know why? A. m3u8 is being accessed, so it cannot be moved
Don't you know why? A. m3u8 is being accessed, so it cannot be moved
So I want to know how to solve this problem?
It can be forcibly replaced.
Disable software that uses this file. No other way
Now, what is the significance of re-uploading?
Disable software that uses this file. No other way
Now, what is the significance of re-uploading?
To implement the HLS protocol,
M3u8 is an index file and its content must be constantly updated.
I just learned that apache runs on windows. The test shows that running in linux can be implemented.
It may be because windows is in use and cannot be replaced. Linux can be replaced.