Reputation: 17
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 />";
}
}
?>
Upvotes: 0
Views: 783
Reputation: 144
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.
Upvotes: 0