Front end post and upload file, image for users without plugin
Use wp_handle_upload in a custom function if ( $_FILES ) { upload_user_file($_FILES[‘test_upload’]); } if ( ! function_exists( ‘upload_user_file’ ) ) : function upload_user_file( $file = array(), $title = false ) { require_once ABSPATH.’wp-admin/includes/admin.php’; $file_return = wp_handle_upload($file, array(‘test_form’ => false)); if(isset($file_return[‘error’]) || isset($file_return[‘upload_error_handler’])){ return false; }else{ $filename = $file_return[‘file’]; $attachment = array( ‘post_mime_type’ => $file_return[‘type’], ‘post_content’ … Read more