wp_handle_upload returns empty error array

I am trying to do an upload via ajax and really dont want to use the regular wordpress media uploader. It is too much stuff and all i want to do is upload single image.

I have everything working the ajax is sending the uploaded file via this Jquery plugin LINK I got it all set up and isn’t the problem.

Read More

Here is my function that is being called to upload however i always am returned this error message.

    if ( !empty($_FILES['files']) ) {
        $daFile = $_FILES['files'];

        $upload = wp_handle_upload($daFile , array('test_form' => FALSE));
        var_dump($upload);

    }

and error message that is returned from $upload

   array(1) { ["error"]=> array(1) { [0]=> int(0) }}

Note I am using WPMU. I have checked online a ton about this but cant see why I am getting this blank error array…

This is for a front end uploader for users. Does wp_handle_upload care about user privileges ie if logged in or not admin? if so what should I do to just upload this damn thing to the server? I just need the url link by the end of this function.

Thanks!

Related posts

1 comment

  1. Okay so Milo was on track to what the answer was. and I needed to brush up on muliple file uploads… anyway the solution for me to at least get it to upload… was this

        $daFile = $_FILES['files'];
        foreach ($_FILES['files'] as $key => $value) {
    
            $daFile[$key] = $value[0]; 
    
        }
    
        $upload = wp_handle_upload($daFile , array('test_form' => FALSE));
    

    this worked for me and retuned the uploaded file.

Comments are closed.