Page 1 of 1

Reading a Flash file located outside the Site Root

Posted: Fri Jan 13, 2006 11:50 am
by spaceman
Hello,

Trying to learn PHP and add it to my site, but running into some difficulties. I am trying to protect some files by placing them outside of the root directory. I want my home page, home/myname/public_html/index.php, to include a Flash file located in home/enddatas/files. I have tried to include the file, but I just get an error saying home/myname/public_html/home/enddatas/files/file.swf doesn't exist.

If anyone can help out, it would be much appreciated.

Thanks.

Re: Reading a Flash file located outside the Site Root

Posted: Fri Jan 13, 2006 12:13 pm
by Chris Corbyn
spaceman wrote:Hello,

Trying to learn PHP and add it to my site, but running into some difficulties. I am trying to protect some files by placing them outside of the root directory. I want my home page, home/myname/public_html/index.php, to include a Flash file located in home/enddatas/files. I have tried to include the file, but I just get an error saying home/myname/public_html/home/enddatas/files/file.swf doesn't exist.

If anyone can help out, it would be much appreciated.

Thanks.
You're missing the leading forward slash.

/home/enddatas/files/file.swf ;)

Linux starts at / for the root don't forget :)

Posted: Fri Jan 13, 2006 12:28 pm
by spaceman
Thanks for the response.

I've actually tried with and without the forward slash.

<? include("home/enddatas/files/HomePageShow.swf") ?> and <? include("/home/enddatas/files/HomePageShow.swf") ?>

Posted: Fri Jan 13, 2006 12:31 pm
by Jenk
/home is not likely to be on root I would of thought.

run this:

Code: Select all

<?php

echo realpath('.');

?>
To see what the current relation to root is.

As for running flash inside the PHP engine.. doubt that would work.

Posted: Fri Jan 13, 2006 12:33 pm
by Chris Corbyn
You can just use relative paths too.... but yes... do run realpath() to make certain where you are.



../../enddatas/files/HomePageShow.swf

Posted: Fri Jan 13, 2006 12:38 pm
by Jenk
but can you include a flash file into php? (I've absolutely no experience with flash..)

Posted: Fri Jan 13, 2006 12:44 pm
by spaceman
Great, I believe that fixed the include issue. I was missing a folder in the directory path. Thanks.

When I run the page now, I get this error:

Warning: Unexpected character in input: '﷓' (ASCII=30) state=1 in /home/enddatas/files/HomePageShow.swf on line 146

Parse error: parse error, unexpected T_STRING in /home/enddatas/files/HomePageShow.swf on line 146


I believe the engine is having issues with the file, as you stated. If it can't be run this way, how would it be possible to hide files like this from users wanting to download it?

Thanks.

Posted: Fri Jan 13, 2006 3:45 pm
by feyd

Posted: Fri Jan 13, 2006 4:29 pm
by wtf
How's this actually protecting your file from being downloaded. You can place it wherever you want on your local system, but once it's in the browser there's no way of stoping anyone from getting hold of your file.