optikalefx Posted September 29, 2010 Share Posted September 29, 2010 im trying to play large files from under the webroot to an html5 video tag. Nothing is working. So i made a sym link to the folder and just header_location to the file. and now when i tell html5 to play /video/play it works but, when i open firebug net tab, i can see the requests are for the full URL to the video file, not the video/play that html5 is using. Obviously because header_location will show the full path. Is there any ways you guys think what im doing is possible? If not, how can i make it that the browser can play the video files, but the user can't go there directly in their browser? Quote Link to comment https://forums.phpfreaks.com/topic/214690-header_location-file-serving-question/ Share on other sites More sharing options...
trq Posted September 29, 2010 Share Posted September 29, 2010 The files always need to be publicly available in order for them to be served to a browser. What you can do however is write a php script which can serve the files, this php file (as well as hiding the actual file location) can then also be used to check your users are logged in or whatever before allowing the files to be served. A simple script might look like.... serve.php if (isset($_GET['movie'])) { $$movie = $_GET['movie']; $expires = 60 * 60 * 24 * 3; $exp_gmt = gmdate("D, d M Y H:i:s", time() + $expires )." GMT"; $mod_gmt = gmdate("D, d M Y H:i:s", time() + (3600 * -5 * 24 * 365) )." GMT"; @header("Content-type: $type"); @header("Expires: {$exp_gmt}"); @header("Last-Modified: {$mod_gmt}"); @header("Cache-Control: public, max-age={$expires}"); @header("Content-Length: {$size}"); @readfile('/fule/path/to/movies/' . $movie); } Quote Link to comment https://forums.phpfreaks.com/topic/214690-header_location-file-serving-question/#findComment-1117020 Share on other sites More sharing options...
optikalefx Posted September 30, 2010 Author Share Posted September 30, 2010 readfile doesn't work for my files that are 1.2 gigs or more. I've been trying so hard to serve video in chunks but i just can't get the hang of it. Quote Link to comment https://forums.phpfreaks.com/topic/214690-header_location-file-serving-question/#findComment-1117417 Share on other sites More sharing options...
optikalefx Posted September 30, 2010 Author Share Posted September 30, 2010 So i have it where it creates a symlink and uses that, it still has to end in ogg or mp4, but its cryptic. Also more importantly its dynamic. So now if only i could delete the symlink if it was accessed more than once. Quote Link to comment https://forums.phpfreaks.com/topic/214690-header_location-file-serving-question/#findComment-1117423 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.