WordPress File Upload with Ajax When Site is Ajaxyfi

Home Forums Technical Support WordPress File Upload with Ajax When Site is Ajaxyfi

This topic contains 1 reply, has 2 voices, and was last updated by  Rahul Bansal 5 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #72443


    I am getting problem in upload any file. My wordpress site is using Ajax Page Loader Plugin.So page is not refreshing when the form is submitting.

    I am not getting any value in Php code in functions.php in print_r($_FILES)

    Html form

    <form id="career_form" name="career_form" enctype="multipart/form-data">
    <span id='errfrmMsg' style='margin:0 auto;'></span>
    Upload : <input id="career_resume" class="field" style="height: 25px;" type="file" name="career_resume" multiple /></td>
    <input type="hidden" name="action" value="career" />
    <input id="submit_button" onclick="submit_career();" type="button" value="Send" />

    j Query

    function submit_career()

    Php code in functions.php

    wp_register_script("ajax-career", get_bloginfo('template_directory')."/js/custom_js.js", array( "jquery"));
    wp_localize_script("ajax-career","the_ajax_career", array("ajaxurl_career" => admin_url("admin-ajax.php")));
    // add actions
    add_action( "wp_ajax_career", "ajax_action_career" );
    add_action( "wp_ajax_nopriv_career", "ajax_action_career" );
    function ajax_action_career(){
    //Nothing getting in this print_r($_FILES) function;
    foreach ($_FILES["career_resume"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
    $name = $_FILES["career_resume"]["name"][$key];
    move_uploaded_file( $_FILES["career_resume"]["tmp_name"][$key], "uploads/" . $_FILES['career_resume']['name'][$key]);

    Rahul Bansal

    Please post your query on http://wordpress.org/support/
    or http://wordpress.stackexchange.com/

    That will be better place to get that answered.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.