MyBB Community Forums

Full Version: How to get $attachedfile?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A plugin named MyDropZone doesn't work on my mybb version.
It has a function like this, that is loaded after uploading attachment:
function mydropzone_handle_attachments(&$args)
{
	global $mybb, $attachedfile, $lang;

	if (!$attachedfile and $args) {
		$attachedfile = $args['attachedfile'];
	}

	$lang->load('mydropzone');

	if (!$mybb->get_input('dropzone', MyBB::INPUT_INT) or $mybb->request_method != 'post') {
	    return false;
	}

	// Handle errors
	if ($attachedfile['error']) {
		http_response_code(403);
		echo $attachedfile['error'];
		exit;
	}

	echo $attachedfile['aid'];

	exit;

}

It looks like $attachedfile['aid']; has NaN value.
I think it just can't refer to that $attachedfile so that there is simply no value.

How can I fix this?

Sorry I decided to upgrade to just newest mybb version so that i dont need to rely on external plugin for drag drop image.