Hello Brajesh,
How can I set a different file upload size limit for mediapress please note that i’m not referring to storage quota but file size limit on media item being uploaded e.g file upload limit is 1.5MB and if user uploads a image, video, music or document of 2MB, the file should not be accepted with an error message.
Features should include abitlity to set different file upload limit for different media files e.g
1. image upload limit is 1MB
2. music upload limit is 5MB
3. video upload limit is 10MB
4. document upload limit is 500KBHi Tosin,
At the moment MediaPress does not set any limit. The limit is set by WordPress on the size of the file(based on site admin preference or server settings).The best way to change it dynamically will be to filter on
upload_size_limit
Regards
BrajeshHi,
We do not control the size. It is Controlled by WordPress(we use the core funtionality for upload).You can limit that using
https://wordpress.org/plugins/upload-max-file-size/ or similar plugins.Regards
BrajeshI tried the plugin but the problem does not change. My server is set at 25 MB and I don’t need to increase the file size but to decrease it. If my users start to insert 10MB images, I believe that in a few months I would have big space problems as well as a burden on the site.
Hi,
If that does not suite the use case(there are other similar plugins on wp.org repo).
You can also use the php.ini to decrease the upload limit on the server.If you have cpanel, you can do it from the php config there or you can ask the hosting support to do it for you.
Regards
BrajeshHi, I solved my problem by adding this piece of code to the function.php file
// Limit upload size
add_filter (‘upload_size_limit’, ‘filter_site_upload_size_limit’);function filter_site_upload_size_limit ($ size) {
// Set the upload size limit to 60 MB for users lacking the ‘manage_options’ capability.
if (! current_user_can (‘manage_options’)) {
// 60 MB.$ size = 500 * 1024;
}
return $ size;
}
add_filter (‘upload_size_limit’, ‘filter_site_upload_size_limit’, 20);Now I’m trying to understand if this procedure can also be performed on the type of file example: max size jpg 500 kb – max size mp4 – 2MB etc etc.
Last night I made some tests and noticed that the plugin offers the possibility of uploading images, videos, audio and docs, but I don’t think I have seen the possibility of inserting a link on youtube for example, and see the preview.
I tried a “buddypress-activity-plus” plugin that performs this function but unfortunately, unlike your plugin, it doesn’t see that part of the code that I pasted it on and that limits users to publish images that are too big
Can you tell me how I can solve the problem?
hi,
Thank you.I am glad you resolved it.
I have replied to your post about the add from url here
https://buddydev.com/support/forums/topic/add-url/#post-26623
Regards
Brajesh
You must be logged in to reply to this topic.