Reading a Flash file located outside the Site Root

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spaceman
Forum Newbie
Posts: 3
Joined: Fri Jan 13, 2006 10:14 am

Reading a Flash file located outside the Site Root

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Reading a Flash file located outside the Site Root

Post 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 :)
spaceman
Forum Newbie
Posts: 3
Joined: Fri Jan 13, 2006 10:14 am

Post 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") ?>
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

but can you include a flash file into php? (I've absolutely no experience with flash..)
spaceman
Forum Newbie
Posts: 3
Joined: Fri Jan 13, 2006 10:14 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post 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.
Post Reply