I am uploading some images and videos to upload folder and then I display those to my webpage using array. that takes extra load on browser. so I want when I upload any image/video to upload folder it should create dynamic html or php file to display for each image/video. Can anyone tell me how to do?
I suggest you to write 2 templates (video and image) and use file_gets_contents and str_replace() and file_put_contents
Example of my idea :
templateVideo.html (or php if you need dynamic)
<html>
<head>
<title></title>
</head>
<body>
<video src="YOUR_DYNAMIC_PATH"></video>
</body>
</html>
upload.php :
# ... your code for upload ...
$videoName = 'myFile.mp3';
$myTemplate = file_get_contents('templateVideo.html');
//str_replace(search, replace, subject)
$myTemplate = str_replace('YOUR_DYNAMIC_PATH', $videoName, $myTemplate);
// file_put_contents(filename, data)
file_put_contents('your_path_and_filename', $myTemplate);
Something like that :)
NOTE : look at mkdir for create dynamic folder if you need