Jump to content

miked12345

Members
  • Posts

    2
  • Joined

  • Last visited

miked12345's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Thanks! I am relativley new (several years doing asp but starting to convert to php) -- do you know of any examples of this in action? Thanks! -Mike
  2. Hi. I am trying to upload multiple files via an FTP PHP script using a wildcard like *.file_extension in FTP using mput or it's equivalent. So far with all the PHP methods I have found, they all list PUT, but none mention MPUT. Here's the script I have (that works for a single file)... Thanks, Mike <?php // set up basic connection $ftp_server = "animalrepellentonline.com"; $conn_id = ftp_connect($ftp_server); $ftp_user_name = "username"; $ftp_user_pass = "******"; $source_directory = "/securityplus/"; $dir = "securityplus/"; $destination_directory = "/web/"; $destination_file = "testdoc.txt"; //$source_file = $dir . "testdoc.txt"; $source_file = $dir . "*.txt"; // List the current local directory echo "<b>Current local directory:</b>" . $dir . "<p>\n"; // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!" . "<br>\n"; echo "Attempted to connect to $ftp_server <b>User name:</b> $ftp_user_name" . "\n"; exit; } else { echo "<b>Connected to:</b> $ftp_server<br><b>User name:</b> $ftp_user_name" . "\n"; echo "<br>"; } // List the current remote directory echo "<b>Current directory:</b>" . ftp_pwd($conn_id) . "<br>\n"; // Change the remote directory if (ftp_chdir($conn_id, $destination_directory)) { echo "<b>Current directory is now:</b>" . ftp_pwd($conn_id) . "<br>\n"; } else { echo "Couldn't change directory\n"; } // Send // upload single file //$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); check upload status if (!$upload) { echo "FTP upload has failed"; } else { echo "<b>Uploaded:</b> $source_file <b>to</b> $ftp_server <b>as</b> $destination_directory$destination_file"; } // close the FTP stream ftp_close($conn_id); ?>
×
×
  • Create New...