Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
right now the output is
./video/Clover Hill Official Music Video Leaves A Scar.mp4
I need it o be
Clover Hill Official Music Video Leaves A Scar
with the addition of 4 extra blank lines at the top

$folder = '../video';
$data = implode(PHP_EOL, glob($folder . "/*.mp4"));

$my_file = 'schedule.txt';
$handle = fopen($my_file, 'w') or die("Cannot open file: ". $my_file);
fwrite($handle, $data);
fclose($handle);


What I have tried:

$handle = fopen($my_file, 'w') or die("Cannot open file: ". $my_file);

modifying this line a few different ways...
Posted
Updated 10-Oct-21 5:51am
Comments
Richard MacCutchan 10-Oct-21 12:00pm    
Modifying that line will not change anything. You need to parse the contents of $data to remove the path prefix.
Peter_in_2780 10-Oct-21 19:21pm    
A quick RTFM works wonders... https://www.php.net/manual/en/function.basename.php

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900