How can I display a SWF file that is out of the document root using SWFObject? I can use PHP if needed.
The reason why the SWF files are outside of the doc root is because the SWFs should only be accessible by paying customers and I don’t wan’t people accessing them for free thru the URL.
How can I display a SWF file that is out of the document root
Share
Couple of options…
Option 1: Create a symbolic link to the SWF file under the document root
For example
ln -s /path/to/file.swf /public/path/to/link.swfThis will not prevent public access to the link.
Option 2: Create a PHP file under the document root to marshal the file using
readfile()or similar. You may have trouble trying to use flashvars or any other request parameters as these generally rely on an HTTP request. Then again, it might just work. Test it and report back 🙂The URL you would pass to SWFObject would be the PHP file.
For example
And in your JavaScript