Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.