Adding filter:
add_filter( 'upload_dir', 'change_upload_dir', 10, 1 );
Function content:
function change_upload_dir($param) {
// Check for REFER
$actual_page = $_SERVER['HTTP_REFERER'];
parse_str( parse_url($actual_page, PHP_URL_QUERY), $query_array );
if ( strpos($actual_page, 'plugin_name.php') ) {
$mydir="/customdir";
$param['path'] = $param['basedir'] . $mydir;
}
return $param;
}
Hope this will help
Other ideas, based not on HTTP_REFERER, are appreciated 🙂
Related Posts:
- custom tabs in media uploader
- How to restrict wp-admin and prevent upload errors
- Client system for media review?
- send information from the thickbox image uploader second tab
- How to remove list view from media library?
- Uploading files in admin panel?
- Thickbox hacking – removing fields
- Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?
- Making Media Library “Alternative Text” Field Required
- Customize the upload screen
- Uploading Images to Multi-Site Causes Failure to HTTP Error
- wordpress upload http error?
- Refreshing collections in the admin media manager
- Editing the Backend Uploader
- Convert (-) and (escape) signs to (_) when uploading files on wordpress media library automatically
- Unable to upload image using the standard uploader in the WP admin (v4.3)
- WordPress post feature image not uploading
- Where to set individual blog quotas?
- WordPress Media Uploader custom Javascript not working
- Custom Jquery in admin breaks media-upload script
- Problem with implenting Uploadify with WordPress
- Upload error on localhost (at minimum, not yet tested online)
- Admin hook after editing an image?
- add instructions to upload pages and / or forms
- Why doesn’t the Media Browser use thumbnail sized images?
- Making a custom upload form and page in the admin section
- how to automatically cleanup failed WordPress uploads in /tmp?
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- if admin is logged in
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- How To Remove WordPress Version From The Admin Footer
- Disable Media Uploads to non Admin Users
- How do I load a CSS style into WordPress admin area only?
- sort child pages on admin
- How do I set up the defualt page icon for admin menu?
- Disable all https in WordPress
- Upload specific images to specific folder
- Can a users profile be put under the dashboard menu
- Styling Shortcodes in Visual Editor
- What’s the easiest way to close comments on media/attachments?
- WordPress admin screen very slow / timing out when editing or adding a new page/custom post
- Is there a hook to put stylesheet and/or JS inside iframes (thickbox or tinyMCE) in admin area
- How to let authors revise other authors drafts, but keep them from publishing?
- Failed media upload: “The uploaded file was only partially uploaded.”
- WordPress last login foreach user
- How to customize this automatic slug shortener with an overrwrite function
- upload featured image from front end using wordpress add media button
- Hide content-box on specific pages (in admin)?
- Moving a WordPress site to a new server
- Add/change multipart_params parameter when uploading post image
- WordPress media upload “HTTP error”
- Admin Notices coding standard issue
- user-new.php less detailed after WP3.1; how to revert?
- Where does WordPress store a list of Super Admins?
- Get current logged in user under 3.1, re: remove “Howdy”
- How do I change Administrator to Super Administrator
- media sideload image not working with JPG file
- Remove Admin sidebar link
- Find Memory Usage of Admin
- Can I hide certain upload folders in media library [duplicate]
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- Out of Memory when Uploading an Image
- One button on admin page works but not two
- Display popup or admin-notice after add new categories
- Is it possible to use media_sideload_image to upload local files?
- How to get the last selected media alignment setting?
- Redirect in an Admin page
- upload_max_filesize is set to 64 MB already but WordPress is still showing 2 MB
- How can I POST or GET to the same admin page from which I am POST-ing or GET-ing
- WordPress admin toolbar not loading styles after migration
- Access for adding subpages but not for pages
- Return User Meta text as links to post edit inside the user columns
- Show global Message in User Profiles with admin only Input field in WordPress Backend
- How to pass a specific post id from “all posts” list in Admin panel
- How should I setup the “Users” area to hand over to a client?
- Cropping thumbnails to specific dimensions on front end post
- Default scripts added to each admin page
- Settings API – Last two tabs not rendered separate
- Hook on file upload
- User uploads image as “Featured Image” but WordPress resizes it?
- Make inline uploader (plupload) on options page upload to a specific folder
- media file uploading
- Adding a WordPress Admin Dashboard to my local wordpress site
- cannot access the wordpress dashboard after changing the site url
- Is it possible to push admin notices to one specific user instead of all users?
- Media files not loading
- How can I create multiple different admin roles with their own capabilities
- Custom redirection when managing users in admin
- How to retain HTML5 Attributes on Markup
- cant able to upload media to my wordpress blog
- Drag and Drop Media Not Working in Windows 10 Edge Browser
- Improving this link color picker code
- Importing blog failed to download attachments from older (still online) blog
- User interfaces living in the Admin “back end” area
- Capability to read/edit page in wp-admin only for administrators
- Can’t upload files
- blank white page in admin, white space hunting?
- WordPress blog code format
- CSS Styles specific to Admin Sidebar not loading
- Image in binary in the data to WordPress media library