开发者

Display SWF object out of the doc root

How can I display a SWF file that is out of the document root using SWFObject? I can use PHP if needed. The reason wh开发者_如何学Pythony 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.


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.swf

This 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

<?php
// marshal-swf.php

// do what you need to do to approve the request

readfile('/path/to/file.swf');

And in your JavaScript

swfobject.embedSWF("marshal-swf.php", /* other options */);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜