I restrict image uploads by file size and dimensions on my client's websites using 'wp_handle_upload_prefilter'.
However, it appears this function is not called when using the WordPress.com mobile app. Authors who use this mobile app method for posting are allowed to upload any size and dimensions via the media library and "featured image" sections.
I assume the mobile app uses the REST API, rather than conventional frontend code. I haven't been able to find any filters for uploads using the REST API. Does anyone know of a workaround?
I understand there are methods of reducing overall file upload sizes across WordPress. This is not a question for the 'upload_size_limit' filter. I restrict both file size and image height/width for images. I also implement a different file size restriction for audio files, etc. I've exhausted research in finding a way to stop my authors from circumventing these restrictions using the WP app, which I assume uses REST. I do not want to prohibit them from using it though.
Oh, I should mention. We are NOT hosted on wp.com. We are using the app to login to our hosted website.
upload_size_limit
only for size limits, and then use the image sizes API to remove sizes you don't want? There's no code to work with or debug in your question so it's difficult to confirm things, and it's unclear why you have this restriction which makes suggesting alternatives difficult ( is it for editorial reasons? are you on a host with limited disk space and trying to avoid it filling up? is this for pagespeed/frontend performance reasons? )