0

How to display only specific files[.mp4] uploaded videos[using a foreach loop condition] from the server, back inside div tag of the website? Also I want to give social-sharing options on each video?

<section>
<div id ="getFile">
<script type="text/javascript">

$("#getFile").html('');
$("#getFile").html('<video src="pathto/myserver/video.mp4" controls></video>');

</script>  
</div>
</section>

Social-sharing options on each video for: 1.Facebook 2.Twitter 3.YouTube 4.Google Plus 5.Instagram

I think this can be achieved using a combination of JQuery and PHP both, although I am not sure as a newbie.

I want to use the php to display the uploaded files inside div possibly by using a for loop, and the recently uploaded files to appear in the (newest first) order. My html file code is also given.

I am using PHP as my back-end. Help will be appreciated. Thanks in advance.

//my php file//

<?php 

$resource = opendir('resources/uploadFiles/');

//loop for all files
while(($entry = readdir($resource)) !== False) {
if($entry !='.' && $entry !='..')
{
echo($entry)."<br />";
}
}
?>

1 Answers1

0

To append a new video into html:

$("#getFile").html('<video src="address of the uploaded-folder on server" controls></video>');

I am not sure about what you want in social sharing.

Elijah Mock
  • 587
  • 8
  • 21
kag
  • 144
  • 1
  • 13
  • at the same time when/where you are loading video from server – kag Apr 20 '17 at 08:48
  • This code works, but the video width is going out of the web main wrapper. see the updated code and please check it , as I am a newbie, so please check it and tell me if I am wrong in any way. – user2228874 Apr 20 '17 at 09:16
  • how to **perform this task inside a looping condition** so all the videos from the server are dispalyed as I have a multiple file upload input. thanks – user2228874 Apr 20 '17 at 11:20