Jump to content

[SOLVED] PHP - FTP Help Requierd


PdVortex

Recommended Posts

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

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. :)

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.