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?
- Get field added via attachment_fields_to_edit filter in Gutenberg
- How to stop filter from running on the index.php page?
- preg_match() not working with post content
- Filter Shortcodes when using get_page
- Search a title word through query_posts (not the exact match)
- Usage of filters
- Action hook to control access to certain parts of my site
- Parse a shortcode differently based on on what it’s nested in
- Need to return shortcode text instead of the output
- Adding a filter to related posts not working
- Image upload and path to custom field
- Upload images – Theme options
- need correction with a snippet in functions.php [closed]
- Use full size images in a specific gallery
- How to get the next and previous image title from attachment or gallery?
- Finding actual functions added to hooks and filters
- Convert all uploaded PNG files to PNG-8 format
- add_filter to the_content after apply_filters
- How to change image’s author via a function when using GravityForms uploader? [closed]
- Random Characters in the end of every image url in post
- Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?
- image URL changed in wordpress
- Add_filter rel=”prettyphoto” to WP3.4.1
- Buddypress Filter Multiple Activities [closed]
- Insert attachments from custom uploader into post (regular uploader style)
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- Excluding posts by meta, and also keeping posts without the meta
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- Image not showing up in media loader success area – followup
- Metabox image upload value
- How to call WordPress First Image Post or else Attached Image or Default
- Where exactly does the edit_{taxonomy} hook fire?