access files outside document 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
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

access files outside document root??

Post by pcoder »

Hi,
I need to access some files that are located outside the document root.
And is there any way to access those files? i wonder if i can access the files that are located outside the document root.
Thanks
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: access files outside document root??

Post by califdon »

What do you mean by "access"? The web server will not serve a page that's outside document root, but you can use php to read any file if you have read privileges for it, and feed the data to the web server.
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: access files outside document root??

Post by pcoder »

Thanks for the reply Califdon.
Actually, according to the client , they don't want to put any video files inside the document root.
And, the files are placed inside the another directory which is outside the document root. I have to access, i mean to play these files from the browser.
Is this possible??
Darkzaelus
Forum Commoner
Posts: 94
Joined: Tue Sep 09, 2008 7:02 am

Re: access files outside document root??

Post by Darkzaelus »

No it isn't.
Playing video files is done client side, so if the client can't see them in the browser, then it can't play them.

Cheers,

Darkzaelus.
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: access files outside document root??

Post by pcoder »

Thanks for the reply Darkzaelus.
We can play the footage from the server location. Like:
http://localhost/footage/test.mpg.
Which is inside the document root.
I think it is preety impossible. I wonder if there is any way to play footage outside the document root.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: access files outside document root??

Post by VladSun »

You may use readfile(), even passthru() or whatever file-read function you like ;)
There are 10 types of people in this world, those who understand binary and those who don't
Darkzaelus
Forum Commoner
Posts: 94
Joined: Tue Sep 09, 2008 7:02 am

Re: access files outside document root??

Post by Darkzaelus »

From the client browser??

Or are you making a php file load the data and set the mime type?

Cheers,

Darkzaelus.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: access files outside document root??

Post by VladSun »

Darkzaelus wrote:Or are you making a php file load the data and set the mime type?
Yes :)
There are 10 types of people in this world, those who understand binary and those who don't
Darkzaelus
Forum Commoner
Posts: 94
Joined: Tue Sep 09, 2008 7:02 am

Re: access files outside document root??

Post by Darkzaelus »

Genius :P
Just pseudo-streaming isn't it. And if they come back without a grabber, they can't get the data!

Kudos to you,


Darkzaelus
Post Reply