Jump to content

mkdir ($direct_user, 777); ??


Phpwho

Recommended Posts

mkdir ($direct_user, 777);

 

Well this works.. It creates a folder when a member signs up with the members name... BUT.. it puts it in my public_html folder and I want it to go into my public_html/members/ folder.

 

I feel like I have done everything under the sun to try and get it to work.. but I havent been able too.

 

Thanks..

Rick

Link to comment
https://forums.phpfreaks.com/topic/47180-mkdir-direct_user-777/
Share on other sites

$dir = "members/" . $direct_user;

mkdir($dir, 777);

 

thats what i had a while ago basically. but try switching to the FTP functions for PHP, its much easier to make sure the directory gets to the place you want it to.

 

Sample:

<?php
$ftp_server = "your_ftp_server";
$ftp_user = "your_ftp_username";
$ftp_pass = "your_ftp_password";

$dir = "members/" . $direct_user;

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
ftp_mkdir($conn_id, $dir);
} else {
    echo "Couldn't connect as $ftp_user\n";
}

// close the connection
ftp_close($conn_id); 
?>

 

Thats the code i now use.

Link to comment
https://forums.phpfreaks.com/topic/47180-mkdir-direct_user-777/#findComment-230072
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.