PdVortex Posted April 25, 2007 Share Posted April 25, 2007 Hello Guy's/Girls, Im very new to php and ftp but i need to know if something is possible. What i need, is some how to create a new folder on my server using php and ftp So basicly some can create a new destination on my website. I.e www.shadow-world.co.uk/the_folder_i_need_created This all needs to be done via the website. Is this possible and if so can anyone point me in the right direction???? Any help would be greatly appreciated. Thanks -V- Link to comment https://forums.phpfreaks.com/topic/48707-solved-php-ftp-help-requierd/ Share on other sites More sharing options...
Glyde Posted April 25, 2007 Share Posted April 25, 2007 http://us.php.net/manual/en/function.ftp-mkdir.php Link to comment https://forums.phpfreaks.com/topic/48707-solved-php-ftp-help-requierd/#findComment-238635 Share on other sites More sharing options...
PdVortex Posted April 26, 2007 Author Share Posted April 26, 2007 Thank you, Just incase anybody else ever need to know : <?php $ftp_server = "ftp.your_website.com"; $ftp_user_name = "you_user_name"; $ftp_user_pass = "your_password"; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); $text = $_POST['textfield']; $dir = $text; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to create the directory $dir if (@ftp_mkdir($conn_id, $dir)) { echo "successfully created $dir\n"; } else { echo "<center>The destination you requested is already in use please try another<br /><center/>"; } // close the connection ftp_close($conn_id); ?> That creates a new directory from a form. Hope this helps someone else And thanks again. Ps may have more question regarding FTP and PHP soon. Link to comment https://forums.phpfreaks.com/topic/48707-solved-php-ftp-help-requierd/#findComment-238683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.