I've created a custom page which updates the custom profile fields and avatar all at once. However, I'm having a problem with the code which uploads a new avatar.
I'm currently using the following code to process the upload, but the error, "upload of file failed" is returned.
PHP Code:
$vbulletin->input->clean_gpc('f', 'avupload', TYPE_FILE);
require_once(DIR . '/includes/class_upload.php');
require_once(DIR . '/includes/class_image.php');
$upload = new vB_Upload_Userpic($vbulletin);
$upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic');
$upload->image =& vB_Image::fetch_library($vbulletin);
$upload->maxwidth = $vbulletin->userinfo['permissions']['avatarmaxwidth'];
$upload->maxheight = $vbulletin->userinfo['permissions']['avatarmaxheight'];
$upload->maxuploadsize = $vbulletin->userinfo['permissions']['avatarmaxsize'];
$upload->allowanimation = ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar']) ? true : false;
if (!$upload->process_upload($vbulletin->GPC['avatarurl']))
{
echo $upload->fetch_error();
}
Does anybody know why this won't work?
Any help would be much appreciated.