Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter lavijain

    (@lavijain)

    please anyone plz help me out …

    is there none who has resolved the issue or i should not use this plugin…

    plz someone help…

    Thread Starter lavijain

    (@lavijain)

    what i see is the image when i upload it goes to a path

    https://www.mysite.com/wp-content/uploads/profiles/newcreatedfolder/image.png

    this is how it is going when i see that it is having problem about at the path image upload not working i added the image manually and i see that image working now but i want upload to work itself where is the problem..

    Thread Starter lavijain

    (@lavijain)

    i guess problem arises here in bold lines..

    // Handles image field type saving.
    if (isset($_FILES[‘field_’.$field_id]) && $_FILES[‘field_’.$field_id][‘size’] > 0) {
    $field = new BP_XProfile_Field($field_id);
    if ($field->type == ‘image’) {
    $ext_allowed = array(‘jpg’,’jpeg’,’gif’,’png’);
    apply_filters(‘images_ext_allowed’, $ext_allowed);
    } elseif ($field->type == ‘file’) {
    $ext_allowed = array(‘doc’,’docx’,’pdf’);
    apply_filters(‘files_ext_allowed’, $ext_allowed);
    }

    $ext = strtolower(substr($_FILES[‘field_’.$field_id][‘name’], strrpos($_FILES[‘field_’.$field_id][‘name’],’.’)+1));
    if (in_array($ext, $ext_allowed)) {
    require_once( ABSPATH . ‘/wp-admin/includes/file.php’ );
    add_filter( ‘upload_dir’, ‘bxcft_profile_upload_dir’, 10, 1 );
    $_POST[‘action’] = ‘wp_handle_upload’;
    $uploaded_file = wp_handle_upload( $_FILES[‘field_’.$field_id] );
    $destino = str_replace(‘0’, $user_id, $uploaded_file[‘file’]);
    $aux = explode(“/”, $destino);
    if (!file_exists(str_replace(‘/’.$aux[count($aux)-1], ”, $destino))) {
    mkdir(str_replace(‘/’.$aux[count($aux)-1], ”, $destino));
    }
    copy($uploaded_file[‘file’], $destino);

    unlink($uploaded_file[‘file’]);
    $value = str_replace($uploads[‘baseurl’], ”, str_replace(‘0’, $user_id, $uploaded_file[‘url’]));
    }
    } else {
    if ($field->type == ‘image’ && (!isset($_POST[‘field_’.$field_id.’_deleteimg’]) || !$_POST[‘field_’.$field_id.’_deleteimg’]) && isset($_POST[‘field_’.$field_id.’_hiddenimg’]) && $_POST[‘field_’.$field_id.’_hiddenimg’] != ”) {
    $value = $_POST[‘field_’.$field_id.’_hiddenimg’];
    }
    elseif ($field->type == ‘file’ && (!isset($_POST[‘field_’.$field_id.’_deletefile’]) || !$_POST[‘field_’.$field_id.’_deletefile’]) && isset($_POST[‘field_’.$field_id.’_hiddenfile’]) && $_POST[‘field_’.$field_id.’_hiddenfile’] != ”) {
    $value = $_POST[‘field_’.$field_id.’_hiddenfile’];
    }
    }

    xprofile_set_field_data( $field_id, $user_id, $value );
    }
    }
    }
    }
    add_action(‘bp_core_signup_user’, ‘bxcft_signup_user’, 10, 5);

    function bxcft_profile_upload_dir( $upload_dir, $user_id=0 ) {
    if ($user_id == 0)
    $user_id = bp_displayed_user_id();
    $profile_subdir = ‘/profiles/’ . $user_id;

    $upload_dir[‘path’] = $upload_dir[‘basedir’] . $profile_subdir;
    $upload_dir[‘url’] = $upload_dir[‘baseurl’] . $profile_subdir;
    $upload_dir[‘subdir’] = $profile_subdir;

    return $upload_dir;
    }

    someone plz help me out…

    Plugin Author donmik

    (@atallos)

    Hi,

    First, please, don’t expect anyone answers you in less than one hour… You’re lucky because I check my email now and I have time to read this thread, but sometimes I have no time to answer immediately…

    About your error, check if you have latest versions of wordpress, buddypress and my plugin. If not, update.

    Then, try to use buddypress default theme, if the error disappear. This issue is related with your theme, if it’s a free theme, write here what theme you are using and when I have time I can check what is happening with your theme. If it’s a premium theme, contact with the support of your theme, maybe they can help, you pay for it…

    You can also try to deactivate all other plugins (not buddypress and mine) and see if the error is still here or not. Maybe another plugin is not working well with my plugin. If you find what plugin is causing this, write here the name of the plugin and if the plugin is free I will try it.

    Thread Starter lavijain

    (@lavijain)

    i am using wp alterna theme i have downloaded alll the plugins from wordpress i am using latest wp version and i guess all the other plugins i have added are latest as i added them from wp site ..

    i guess problem is here where i shown in code the file can’t be uploaded …

    Plugin Author donmik

    (@atallos)

    Why do you think the error is in the code you write?

    Like I say before, Alterna is a premium theme so I can’t help you. Try to activate default buddypress theme to see if the error is still here. Many themes are not well coded, they have many mistakes and don’t use the latest hooks from buddypress so maybe you need to contact the support of Alterna Theme.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘image and file upload not have upload button(not working)’ is closed to new replies.