This is how you can limit the image upload size
function fineima() {
if (isset($_POST['submit'])) {
wp_upload_bits($_FILES['fileToUpload']['name'], null, file_get_contents($_FILES['fileToUpload']['tmp_name']));
}
echo '<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
';
}
function fineFileUploaderRenderer() {
ob_start();
fineimageUpload();
return ob_get_clean();
}
add_shortcode('your_file_uploader', 'fineFileUploaderRenderer');
Related Posts:
- Disable resizing of gif when uploaded
- Overriding Generated Attachment Post URL
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Removing Image and Caption Dimension Attributes
- Changing JPEG compression depending on image size
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- Disable image attachment links
- Change upload directory on custom plugin page
- hook into completed image upload filter
- WP Rest API – Upload media without saving attachment post
- Get attachment ID of author_meta image – Attachment Metadata
- Can I add custom meta for each image uploaded via media-upload.php?
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- How can I display image metadata?
- Rename image uploads with width in filename
- How do i upload an image and return the image id?
- Automatically wrap post image in div
- How to display a shortcode caption somewhere other than the_content
- WordPress 3.5+ upload tool filter
- Image size filtering in Media uploader according to custom post type
- How to upload image without post ID using the new media uploader?
- Is it possible to Hook/Filters Attachment Creation?
- Rename attachments during upload
- Filter to modify post_title after image upload?
- Add suffix to filename of uploaded images
- How can I add a fifth option to the alignment picker?
- How to check if “media_send_to_editor” is audio?
- Best way to programatically add “rel” attributes to page and post images
- Add a header before fields added with the attachment_fields_to_edit() filter
- Pass parameter to the upload_dir filter
- Allow EPS file upload – two EPS files have different MIME types
- Move a file from a directory to another
- media_sideload_image with rewritten urls?
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- How to remove attachments size attribute [duplicate]
- Handling image uploads without thickbox
- Disable auto-resizing of uploaded images, but only for certain filename
- upload_files cap to not loggen in users – add_cap to not logged in users
- Auto delete attachments that are older than x days
- Redirect to another page using contact form 7? [closed]
- Does wp_get_attachment_image_src also work with non-image files?
- Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?
- Get images attached to a specific page
- WordPress Creates Unused (Unregistered) Image Sizes
- Upload attachment from external site
- Filter causing loss of _wp_attachment_metadata
- WP_Query: attachment image in “full” size?
- Filter Media by attached page or blog post in Library
- How to display a warning when an uploaded image is too small?
- How to change an image source when rendering on frontend?
- Show uploaded pdf files dynamically and filter by month name
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- How to disable post-thumbnail from generation?
- Custom permalink for attachment
- List all image sizes still getting disabled sizes
- Troubles with code for upload a image
- How to get to the date of the uploaded file
- After I upload a file to library its name converted to dashes
- How to replace all images in all posts and pages with a different size?
- Post Type Upload Directory – {post_type}_upload_dir filter
- Surround uploaded image link with div
- How to force attachment size for every post
- can’t output gray scaled image I’ve created using add_image_size
- Rename uploads filenames to POST-ID on upload
- Upload unnattached image from frontend
- add_filter with specific thumb names
- get_image_tag filter not working
- How to get WordPress to resize images for srcset?
- How to add defer=”defer” tag in plugin javascripts?
- WordPress Internal @ Mentions
- Default Image Link Removal
- Create Image Uploader for Widget
- How to copy and paste a picture found on the web to wordpress easily
- How to add attributes to tag when template cannot be directly modified
- Edit pagination text in the get_the_posts_pagination function
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- SSL: How to make customizer images Protocol Relative in WordPress?
- Converting Attachment to Images?
- How to add ‘total’ value to custom column title on the posts list page
- Image rotation fails to regenerate custom sized thumbnail
- Create Page Template by hook programatically in Functions.php in WP 5.8.1
- Force minimum image size and aspect ratio when uploading images
- Images in Media aren’t showing, not broken
- HTML and custom field variable, inside variable
- WordPress Media Library showing wrong preview size?
- How to add a filter to the get_body_class function?
- How to test if there are no more previous or next image on attachment page?
- How can I get the default content of WordPress post?
- How does wordpress add ‘style’ attribute to element
- How do I safely force get_theme_mod() to use a defined get_option(“stylesheet”) value?
- Shortcode / plugin with custom (flexible) output
- How to use getimagesize() of image upload?
- Is it better to use a constant or apply_filter?
- Filter not applied to all image sizes
- Add option to query string before get_posts() is called on archive.php
- Modify wp headers on specific page
- Why this remove empty paragraphs from the_content does not works?
- How To Query All Attachment Images Found In Post Galleries
- Taxonomy search filters
- Change password reqts with NO plugin without breaking resetpass link?