Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • sniexx I have the same problem with swedish characters ?,?,? when they are in first in a row!
    Is there a fix for this problem?

    Thanks!

    1) You should change everything if the name isn’t right, my input name is:
    <input name="cimy_uef_AVATAR">

    So if your name is IB60-13-UPLOAD then you should only have that in the php functions.

    2) the path is for the folder on your ftp like this
    $upload['path'] = ABSPATH.'wp-content/Cimy_User_Extra_Fields/'.$current_user->user_login.'/avatar';
    and the url is for the link in the browser window like this
    $upload['url'] = content_url().'/Cimy_User_Extra_Fields'.$current_user->user_login.'/avatar';

    I also made some fixes for files that have space in it’s name you should add these lines to your code to get it working correctly.

    $file = $_FILES['cimy_uef_AVATAR']['name'];
    	$file = str_replace(" ","-", $file);
    	$path = content_url().'/Cimy_User_Extra_Fields/'.$current_user->user_login.'/avatar/'.$file;

    and then also change the media query to this
    $wpdb->query("UPDATE wp_cimy_uef_data SET VALUE='$path' WHERE USER_ID=$user AND FIELD_ID=2");

    dannykater had the same problem and couldn’t find anything inside the plugin so I made my own solution for it. here it is maybe not the best solution though.

    if (
    isset( $_POST['cimy_uef_NAME_nonce'])
    && wp_verify_nonce( $_POST['cimy_uef_NAME_nonce'], 'cimy_uef_NAME' )) {
    
    	require_once( ABSPATH . 'wp-admin/includes/image.php' );
    	require_once( ABSPATH . 'wp-admin/includes/file.php' );
    	require_once( ABSPATH . 'wp-admin/includes/media.php' );
    
    	$file = $_FILES['cimy_uef_NAME']['name'];
    	$user = $current_user->ID;
    
    	if($file==true){
    		add_filter('upload_dir', 'my_file_dir');
    		function my_file_dir($upload) {
    			global $current_user;
    
    			$upload['path'] = 'FOLDER_FOR_FILE/';
    			$upload['url'] = 'URL_FORFILE';
    			return $upload;
    		}
    
    		media_handle_upload( 'cimy_uef_NAME', 0);
    		$wpdb->query("UPDATE wp_cimy_uef_data SET VALUE='$file' WHERE USER_ID=$user AND FIELD_ID=1");
    	}
         }

    hi Moonblossom
    did you get it to work? have the same problem just wondering how did u solve it ?

Viewing 4 replies - 1 through 4 (of 4 total)