You don’t need to use strpos()
to figure out the extension because you’ve already parsed the URL above and stored the extension in $AllAtachmentURLextension
, so all you need to do is
//for Specific Extensions
if( 'docx' == $AllAttachmentURLextension ) {
// docx handling here
}
elseif ( 'pdf' == $AllAttachmentURLextension ) {
// pdf handling here
}
Related Posts:
- Where do the favicons for Media Files come from
- How to get all files inserted (but not attached) to a post
- Password protect some uploaded files, so only logged-in users can view them
- Images not being generated at correct size
- Use the WP media uploader dialog for uploading a form attachment (non-admin). Offering progress and drag and drop feedback
- What is the way to add additional fields to attachments in 3.5+?
- A link (not in the post) to download a specific PDF file
- How does WordPress decides how many sizes of an image to create?
- Insert attachments from custom uploader into post (regular uploader style)
- PDF Upload from Input Error
- Do custom post type (CPT) attachments/media store the parent post ID?
- Adding attachment custom field metadata to TinyMCE tag
- Check if author or uploader id of the attachment(uploaded) image is match?
- Limit attachment caption characters
- controlling whether upload is attached to post or not
- Updating Media Library PDF’s in bulk
- How to properly move media files and update data?
- How to Fix HTTP Error When Uploading Images?
- How to add new tab to media upload manager with custom set of images?
- Extend Media Library
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- How to make “Upload files”selected by default in Insert Media?
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- simple solution for restricting access to (some) uploads/downloads
- what happens to existing media files when I switch to year/month directory structure format?
- Reject upload of wrong-sized images using the Media Uploader
- How to show all available images in WP’s media library when using the Polylang plugin?
- How to add a custom field to the media screen (image/gallery)?
- Can’t upload media, permissions are correct
- Saving Media – Which Hook is Fired?
- Set limit to media upload?
- WordPress 3.5: Switch back to Old Media Uploader?
- upload_async.php returns 500 error
- Which filters or actions to use after a media upload and delete?
- Display attachments by ID in a wp.media frame
- Use a separate custom table (not posts) to handle file upload data
- Image upload callback in new 3.5 media
- Add inline uploader to plugin option page
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- Can I use the wp media uploader for my own plugin?
- How to wp_upload_bits() to a sub-folder?
- Insert images to post not working
- “Add Media” only shows “Full Size” under Attachment Display Settings
- Differentiate Featured Image from Post Images upon Upload
- Uploading Multiple Attachments From Front-End With A Description
- How to manage a standalone media folder?
- wp_generate_attachment_metadata returns empty array
- Saving images from Gravity Forms repeatable File Upload as post attachments [closed]
- How do I link directly to uploaded files?
- Is it possible to trigger some JavaScript when Media Popup is opened?
- How to call WP3.5 Media Library manager?
- Is wp_read_audio_metadata() function deprecated?
- Settings in ‘Media > Settings’ is ignored when inserting images
- Set a maximum upload count for users on a specific user role
- Refresh wp.media after ajax call
- I want to replace a media file (pdf) with an updated version
- There’s a way to scale media (images) at 50%?
- Multisite, upload images directly to Amazon S3
- wp_editor with media buttons
- How to protect uploads in multisite if user is not logged in?
- Media Uploader: get deleted files
- WordPress REST Upload Media
- using media uploader to select image of specific size, enforce cropper
- Trigger JS when featured image upload window is opened in admin
- Force wordpress to see uploads folder media
- Append button to WordPress Image Details modal
- How to check if an image attachment exists before uploading
- Modify the array of selected images in media modal
- How to validate the file name of the Media File Uploads?
- Disable TinyMCE Drag and Drop
- How do i upload an image and return the image id?
- WP3.5 Media Uploader – how to make it accept multiple images?
- File upload from front-end form (as attachment) not working
- 3.5 media manager add CSS / JS to new ‘tab’ iframe content
- Add/change multipart_params parameter when uploading post image
- Media uploader not work properly [closed]
- Post Specific Uploader
- Setting wp_temp_dir and permissions not working for “Missing A Temporary Folder” error
- http error when uploading media files
- Upload images and attachments from frontend form
- Add suffix to filename of uploaded images
- Select image sizes you want to be uploaded
- wp_temp_dir does not change the /tmp temporary default directory
- Check if image exists before uploading with media_sideload_image()
- Add a YouTube or Vimeo video as a post attachment?
- Retrieving JSON data in ajax request from media uploader
- Maximum upload size changes in php.ini ignored – How to remove upload size limit?
- How to disable WordPress Media resize different size version?
- How to change “Publish” button text for specific page
- Saving WordPress generated thumbnails in a subdirectory
- Media upload via backend doen’t work after moving site
- Whole bunch of errors on WP website – media upload, edit slugs, edit screen not working [closed]
- Setting higher upload limit
- Media library storing files in uploads not folders within in uploads
- How can I save the original filename to the database?
- How to side load an image from a service
- Add select field to media uploader that adds a class to the image
- Media handle sideload not working
- How to overwrite wp_unique_filename logic
- How to change upload directory based on frontend form input name or ID?