Hello, I am storing files in a root directory on my web host to protect the files. I call them when users that login request the files.
On a user page, people can upload videos and I use PHP and mySQL to store the file names and it uploads the file to the root directory. Then, when I select the results from the mySQL table, I use this code to play the video-
$videorealname = stripcslashes($videorealname);
$videorealname = urlencode($videorealname);
$totalfilepath = $filepath.$videorealname;
<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='320' height='290'>
<param name='FileName' value='$videoname'>
<param name='AutoStart' value='True'>
<param name='ShowControls' value='True'>
<param name='ShowStatusBar' value='False'>
<param name='ShowDisplay' value='False'>
<param name='AutoRewind' value='True'>
<embed type='application/x-mplayer2'
pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/' src='$totalfilepath' width='320' height='290' autostart='True' filename='$videoname' showcontrols='True' showstatusbar='False' showdisplay='False' autorewind='True'></embed>
</object>
I tested the player without using PHP and upload a movie file in the same directory as the file and then changed the source to the file name and it worked, so I know that the media object itself is working fine. Any ideas?
Also, I have used this root address before when I stored images and then I read the files using PHP and it worked. Not sure if there is a difference if you don’t use
readfile
or not…
Anything will help!
THanks