|
![](/images/resource/spacer.gif) |
|
หลังจากกดปุ่มอัปโหลดไปแล้ว ต้องการให้แสดงวิดีโอที่อัปโหลดด้วยอะครับ รบกวนด้วยครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
![bio bio](https://www.thaicreate.com/upload/stock/20170329212332.jpg?v=1001)
ปัญหาของผมก็คือ หลังจากกดปุ่มอัปโหลดไปแล้ว ต้องการให้แสดงวิดีโอที่อัปโหลดด้วยอะครับ
Code (PHP)
$typename=array("mp3","mp4");
$temp = explode(".",$_FILES['file']['name']);
$extension=end($temp);
if (($_FILES['file']['type'] == "video/mp3") ||
($_FILES['file']['type'] == "video/mp4") && in_array($extension,$typename)) {
$target="upload/";
move_uploaded_file($_FILES['file']['tmp_name'],$target.$_FILES['file']['name']);
echo "upload/".$_FILES['file']['name'];
}else{
echo"Error";
}
Code (JavaScript)
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script>
$(function(){
$('#myform').ajaxForm({
beforeSend:function(){
$('.progress').show();
},
uploadProgress:function(event,position,total,percentcomplete){
$(".progress-bar").width(percentcomplete+"%");
$('#msg').html(percentcomplete+"%");
if (percentcomplete == 100){
//alert("Complete");
}
},
success:function(){
$('.progress').hide();
},
complete:function(response){
$('.showvideo').html("<source src"+response.responseText+"/>");
},
});
$('.progress').hide();
});
</script>
Tag : PHP, HTML/CSS, JavaScript, Ajax, jQuery
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-03-29 21:27:00 |
By :
Newmo |
View :
701 |
Reply :
1 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
หลังจากที่อัพโหลดเสร็จให้ใช้การ Redirect ไปอีกหน้า แล้วใช้ video เล่นได้เลยครับ
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2017-03-30 09:28:13 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 05
|