In general a subscriber or contributer type user have not permission to upload image in wordpress so to give permission to upload image to subscriber or contributer type user need to write function or install a plugin
The functions to give file upload permission to a user
Now write the code in your functions.php file to give image upload permission to subscriber type user
<?php if ( current_user_can('subscriber') && !current_user_can('upload_files') ): add_action('init', 'hm_allow_subscriber_uploads'); function hm_allow_subscriber_uploads() { $subscriber = get_role('subscriber'); $subscriber->add_cap('upload_files'); } endif; ?>
and write the code in functions.php file to give image upload permission to contrubuter type user
<?php if ( current_user_can('contributor') && !current_user_can('upload_files') ): add_action('admin_init', 'allow_contributor_media'); function allow_contributor_media() { $contributor = get_role('contributor'); $contributor->add_cap('upload_files'); } endif; ?>
You can use the Capability Manager Enhanced plugin also to give permissions
and for that first chose user then select the permission you want to give and press save.
Permission to upload from frontend
You need to use the code add_action('init', 'allow_contributor_media');
in place of admin_init if you are using the code or function writing in functions.php file , or if you are using the plugin Capability Manager Enhanced then you need to give all the permission for pages then only you can be able to upload image from front end.