Created
November 8, 2016 20:48
-
-
Save Shelob9/fe0531e1dce3692eb8d4d5488ae1e320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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