$upload = wp_upload_bits($_FILES[“userpic”][“name”], null, file_get_contents($_FILES[“userpic”][“tmp_name”]));
to see what you are getting back.
]]>echo 'debug01='.print_r($upload);
else
statement after the if isset
like so:
if( isset($_POST['submit']) ) {
add_user();
} else{
echo "Could not upload user details";
}
the string is echoed back in the FRONTEND of my site.
]]>and im getting this:
Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\wordpress\wp-content\themes\themename\functions.php on line 31
Array ( [error] => Empty filename ) debug01=1
i don’t understand why its saying the filename is empty though?
]]>The php variable $_POST is an array. What is probably happing is that since you are using this in the WP backend, when you hit the submit button, it is not your form’s submit button but WP’s and it does not have the “name=…” in the input statement. You might want to echo $_post to see what it contains. I’ll bet it does not contain a key of ‘submit’
Just after
function add_user(){
add
echo 'debug2 ='.print_r($_POST).'<br><br>';
and look at the results.