Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created November 8, 2016 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/fe0531e1dce3692eb8d4d5488ae1e320 to your computer and use it in GitHub Desktop.
Save Shelob9/fe0531e1dce3692eb8d4d5488ae1e320 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'caldera_forms_file_upload_handler', 'my_custom_uploader' );
function my_custom_uploader( $file, array $args = null ){
if( extension_loaded('ssh2' ) && function_exists( 'ssh2_connect' ) ) {
$connection = ssh2_connect( YOUR_FTP_SERVER, 22 );
ssh2_auth_password( $connection, YOUR_FTP_PASSWORD, YOUR_FTP_USERNAME );
return ssh2_scp_send( $connection, $file['tmp_name'], basename( $file['tmp_name'] ), 0640 );
}else{
return Caldera_Forms_Files::upload( $file, $args );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment