Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3243850
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:28:53+00:00 2026-05-17T18:28:53+00:00

I’m trying to use wordpress’ built-in ajax to process an upload using the AjaxUpload

  • 0

I’m trying to use wordpress’ built-in ajax to process an upload using the AjaxUpload script. The script was updated in august, and now i can’t get it to work any more.

http://valums.com/ajax-upload/

here’s my jquery… this seems to be in place as i get input is transformed into an upload button and on selection of the image it begins to attempt to upload automatically.

jQuery.noConflict();
jQuery(document).ready(function($) {

/*
 * AJAX UPLOAD
 * http://valums.com/ajax-upload/
 */


var uploader = new qq.FileUploader({
    // pass the dom node (ex. $(selector)[0] for jQuery users)
    element: document.getElementById('file-uploader'),
    // path to server-side upload script
    action: ajaxurl,
        params: {
        type: "POST",
        action: 'save_function',
        key: 'logo',
         },
    onComplete: function(id, fileName, responseJSON){

        console.debug("Here is the response: %o", responseJSON);
    }

});


}); //end document.ready functions

my action is set to ajaxurl which is the constant for /wp-admin/admin-ajax.php, i passed an action in the params so that admin-ajax would know what function i wanted to run to process things. and my callback function

function childtheme_data_save_callback() {
    global $my_shortname;


    $id = $_POST['key']; // option name

        $upload = wp_handle_upload($_FILES['qqfile']['tmp_name'], array('test_form' => false));        

    if(!empty($upload['error'])) { //there IS an error message
        die($upload['error']);
    } 
    else { // there is NOT an error
        $upload_image = $my_data; //preserve current data
        $upload_image[$id] = $upload['url'];
        update_option($my_shortname .'_options', $upload_image ) ;
        die($upload['url']); //response sends url back to jquery
    }


}


add_action('wp_ajax_save_function', 'childtheme_data_save_callback'); 

which is getting called and my error message is showing in my firebug console. here is the error

File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.

dabbling w/ changing the error messasge to $_FILES it always comes back an empty array, even though in console it says the POST is filled w/ stuff that looks like

ÿØÿà�JFIF��_�_��ÿÛ�C�    $.' ",#(7),01444'9=82<.342ÿÛ�C  2!!22222222222222222222222222222222222222222222222222ÿÀ�°

and more. though now i see that console also says the Response Headers have a content type of:
Content-Type text/html; charset=UTF-8

and the request headers accept:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

is the problem then in not sending the POST in “multipart/form-data” encoding? if so how do i switch to that since i’m using this plugin and not a form tag? if not, well i have been stumped for a while now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:28:54+00:00Added an answer on May 17, 2026 at 6:28 pm

    You need to check the GET variable qqfile, and if it is set, it contains your file name, while the file is in the post data. The js package you got most likely contains examples/samples in various server side scripts. Also note that if the GET qqfile variable is not set you should fall back to loading with FILE[] for older browser support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.