close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Automatically upload a file via FTP (for use with a scheduled CRON job)

Thread began 7/10/2017 8:32 am by Jared Lui | Last modified 7/14/2017 12:54 pm by Jared Lui | 1141 views | 12 replies

Ray BorduinWebAssist

I think this will work:



//-- Connection Settings
$ftp_server ""// Address of FTP server.
$ftp_user_name "pentagonposts"// Username
$ftp_user_pass 'password'// Password
$destination_folder ""//where you want to throw the file on the webserver (relative to your login dir)

$conn_id ftp_connect($ftp_server) or die("<span style='color:#FF0000'><h2>Couldn't connect to $ftp_server</h2></span>"); // set up basic connection

$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass) or die("<span style='color:#FF0000'><h2>You do not have access to this ftp server! /h2></span>"); // login with username and password, or give invalid user message

if ((!$conn_id) || (!$login_result)) { // check connection
// wont ever hit this, b/c of the die call on ftp_login
echo "<span style='color:#FF0000'><h2>FTP connection has failed! <br />";
"Attempted to connect to $ftp_server for user $ftp_user_name</h2></span>";
} else {
//echo "Connected to $ftp_server, for user $ftp_user_name <br />";

$files array_slice(scandir($foldername), 2);
for (
$x=0$x<sizeof($files); $x++) {

$upload ftp_put($conn_id$destination_folder $files[$x], $foldername $files[$x], FTP_BINARY); // upload the files
if (!$upload) { // check upload status
echo "<span style='color:#FF0000'><h2>FTP upload of " $files[$x] . " has failed!</h2></span> <br />";
  } else {
"<span style='color:#339900'><h2>Uploading " .$files[$x] . " Completed Successfully!</h2></span><br /><br />";
ftp_close($conn_id); // close the FTP stream

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...