ช่วยหน่อยครับ ผมอยากทราบวิธีการเช็คไฟล์วีดีโอหน่อยครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ช่วยหน่อยครับ ผมอยากทราบวิธีการเช็คไฟล์วีดีโอหน่อยครับ
ช่วยหน่อยครับ ผมอยากทราบวิธีการเช็คไฟล์วีดีโอหน่อยครับ
ผมต้องการจะตรวจสอบไฟล์วีดีโอที่ user มีการอัพโหลดเข้ามา เเละได้มีการเลือกประเภทของวีดีโอนั้นไว้ ว่าวีดีโอที่อัพโหลด ตรงกับประเภทที่เลือกหรือไม่ สามารถตรวจสอบได้ไหมครับ หรือควรจะตรวจสอบยังอย่างไร

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | <?php // Check if the form is submitted if ( $_SERVER [ 'REQUEST_METHOD' ] == 'POST' ) { // Check if the file is uploaded if (isset( $_FILES [ 'video' ]) && $_FILES [ 'video' ][ 'error' ] == 0) { // Allowed video mime types $allowedMimeTypes = [ 'video/mp4' , 'video/x-msvideo' , // .avi 'video/quicktime' , // .mov 'video/x-ms-wmv' , // .wmv 'video/x-flv' , // .flv 'video/webm' , // .webm ]; // Get the file's mime type $fileMimeType = mime_content_type( $_FILES [ 'video' ][ 'tmp_name' ]); // Validate the mime type if (in_array( $fileMimeType , $allowedMimeTypes )) { echo "File is a valid video type: " . $fileMimeType ; // Proceed with further processing (e.g., move the uploaded file) } else { echo "Invalid video file type." ; } } else { echo "Error in file upload." ; } } ?> <!-- HTML Form for video upload --> <form action= "" method= "post" enctype= "multipart/form-data" > <input type= "file" name= "video" > <input type= "submit" value= "Upload Video" > </form> |

ขอบคุณทุกการสนับสนุน
![]()