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.
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!
multiple
attribute, are you sure$_FILES['files']
isn't an array?name
is an array with length of 1, where that single array element contains the name in the form of a string. if it weren't a multiple file upload,name
would just be a string. have a look in the php docs at example #3