Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_device_can_upload() WordPress Function

The device_can_upload() function is used to check whether a user is able to upload files from a given device. This is useful for checking whether a user is able to upload files from a mobile device, for example.

_device_can_upload() #

Test if the current device has the capability to upload files.


Return

(bool) Whether the device is able to upload files.


Top ↑

Source

File: wp-includes/functions.php

function _device_can_upload() {
	if ( ! wp_is_mobile() ) {
		return true;
	}

	$ua = $_SERVER['HTTP_USER_AGENT'];

	if ( strpos( $ua, 'iPhone' ) !== false
		|| strpos( $ua, 'iPad' ) !== false
		|| strpos( $ua, 'iPod' ) !== false ) {
			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
	}

	return true;
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More