I'm uploading image in php using (move_uploaded_file()) function, but image is not uploading in the folder where i want to upload it even after mentioning the folder path in macbook m1 chip


I see there are two mistakes within your code.
First with the $uploaddir. Is it a relative path? If yes then why it contains htdocs? it should not. Path should look like /directory
Secondly, you forget to add a slash between the dir and basename. So your script is considering it as a whole name of the directory.
$uploadfile = $uploaddir.'/'.basename($_FILES['userfile']['name']);
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir);
MAX_FILE_SIZEequals 30000 (just like in the PHP documentation), which means that images above 30KB will be refused. That's what happens when you copy code without understanding it...