TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-18-2008, 06:03 PM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default mkdir - need help

im trying to make this code work

Code:
$userid =  $_COOKIE['usersid'];
$foldername = "/upload/".$userid;	
mkdir($foldername) or die("error");
so a directory will be created inside the upload folder by the name that is stored in the cookie.

this is the error im getting

Code:
Warning: mkdir() [function.mkdir]: Permission denied in /home/gothostin/www/www/checklist/intro.php on line 8
error
if this is a permission problem, how do i set chmod to 777 ?

the weird thing is when i tried doing this

mkdir(testfolder); it worked and the folder was careted. but when i try doing that it doesnt work..

any ideas?
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 08-18-2008, 07:07 PM   #2 (permalink)
The Frequenter
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Quote:
Originally Posted by sarmenhb
if this is a permission problem, how do i set chmod to 777 ?
Via FTP or SSH.

Quote:
Originally Posted by sarmenhb
mkdir(testfolder); it worked and the folder was careted. but when i try doing that it doesnt work..
It worked probably because the directory in which you are executing the file is not /upload/.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 08-18-2008, 08:06 PM   #3 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Just a note, 0755 should be good enough for anything you need to do - setting any permissions to 0777 is dangerous, and should be avoided if at all possible.

Tutorial for chmod
chmod - Wikipedia, the free encyclopedia

-m
delayedinsanity is offline  
Reply With Quote
Old 08-18-2008, 08:40 PM   #4 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 312
Thanks: 8
tony is on a distinguished road
Default

you could use the exec() function to execute a command in the computer and use the chmod command in it.
tony is offline  
Reply With Quote
Old 08-18-2008, 09:25 PM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,298
Thanks: 17
Village Idiot is on a distinguished road
Default

Some hosts don't let you create directories from the application user for security/speed reason (they would have to create a new user for every account). This is one of the many reasons I do not like shared hosting.
__________________

Village Idiot is offline  
Reply With Quote
Old 08-18-2008, 09:34 PM   #6 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by tony View Post
you could use the exec() function to execute a command in the computer and use the chmod command in it.
Or use the builtin chmod() function:
PHP Code:
chmod('/kalle/desktop/'0755); 
More notes on the function is ofcourse available on its documentation: PHP: chmod - Manual
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 08-18-2008, 09:41 PM   #7 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 312
Thanks: 8
tony is on a distinguished road
Default

Quote:
Originally Posted by Kalle View Post
Or use the builtin chmod() function:
PHP Code:
chmod('/kalle/desktop/'0755); 
More notes on the function is ofcourse available on its documentation: PHP: chmod - Manual
yeah much better, I overlooked that one.
tony is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:30 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design