Create a dir outside of root dir

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
912bliss
Forum Newbie
Posts: 6
Joined: Wed Jul 14, 2010 4:53 am

Create a dir outside of root dir

Post by 912bliss »

I am trying to create a dir outside of the root Dir on a web server, So i can move the full size images(jpg) into the dir after they are uploaded. i know the solution is staring me in the face but I'm drawing a blank .Is this possible in php

Any help would be appreciated
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Create a dir outside of root dir

Post by yacahuma »

just manually create the directory you want , ex c:\imgstorage and give the read write permission to your webserver user(sometimes nobody in unix) then you can use php to keep creating subfolders or just place the images there.
912bliss
Forum Newbie
Posts: 6
Joined: Wed Jul 14, 2010 4:53 am

Re: Create a dir outside of root dir

Post by 912bliss »

if my home directory is /mydomain.com i want to create a dir called "/images/events "outside of /mydomain.com. I have tried a number of ways the last one is as follows
The dir /images is already created manually
mkdir('/images/events',0777,true);
chmod('/images/events', 0777);

Still doesn't work

Any advice
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Create a dir outside of root dir

Post by yacahuma »

are you in one of those shared hosting that limit php or do you have full control?
912bliss
Forum Newbie
Posts: 6
Joined: Wed Jul 14, 2010 4:53 am

Re: Create a dir outside of root dir

Post by 912bliss »

Got it sorted thanks for the advice
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Create a dir outside of root dir

Post by yacahuma »

what was it?
912bliss
Forum Newbie
Posts: 6
Joined: Wed Jul 14, 2010 4:53 am

Re: Create a dir outside of root dir

Post by 912bliss »

the root of my domain was not /images it was found using $_SERVER['DOCUMENT_ROOT]
Post Reply