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?
- How to Protect Uploads, if User is not Logged In?
- What are the standard admin CSS id/class tags?
- Admin Ajax is returning 0
- Add custom column to Users admin panel
- How to Fix HTTP Error When Uploading Images?
- wp_verify_nonce vs check_admin_referer
- Add a Separator to the Admin Menu?
- How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
- how to know if admin is in edit page or post [duplicate]
- How to add new tab to media upload manager with custom set of images?
- Modal window from within WordPress admin
- Where in WP can I check history or log of updates of plugins etc?
- Add “upload media” button in meta box field
- Adding a custom admin page
- Extend Media Library
- How does admin-ajax.php work?
- How Can I Add the “Insert From URL” Tab to a Custom 3.5 Media Uploader?
- 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?
- How to remove entire admin menu?
- How do I remove dashboard access from specific user roles?
- “Add Media” button in custom plugin
- How can I speed up my WP admin section?
- How to pass parameters to admin_notices?
- Upload images to remote server
- Admin: very slow edit page caused by core meta query
- 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
- if admin is logged in
- Search posts by ID in admin
- How to Change the Default Home Page for the WordPress Dashboard?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Find out which moderator approved comment?
- The website cannot display the page
- How To Remove WordPress Version From The Admin Footer
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Hide other users’ posts in admin panel
- Set Default Admin Colour For All Users
- How to show all available images in WP’s media library when using the Polylang plugin?
- Editor Styles and Typekit
- WordPress admin stylesheet
- How to increase the file size limit for media uploads?
- This CSS Stuffing Works, But Is This A Good Practice?
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- How to add a custom field to the media screen (image/gallery)?
- Uploading media with the REST API
- Saving data-URI to media library
- Can’t upload media, permissions are correct
- Saving Media – Which Hook is Fired?
- Set limit to media upload?
- is_admin() returns true when using admin-ajax.php from front end script
- WordPress 3.5: Switch back to Old Media Uploader?
- How to save dismissable notice state in WP 4.2?
- How do I optimize a custom post type admin page with 25,000 posts?
- Settings API – adding setting fields dynamically?
- Disable Media Uploads to non Admin Users
- How do I load a CSS style into WordPress admin area only?
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Can an admin check passwords of registered users?
- How can I target WordPress 3.8 new interface MP6 with CSS?
- upload_async.php returns 500 error
- Which filters or actions to use after a media upload and delete?
- Notification that the admin is online
- Decrease file size upload in Media
- Remote upload file to server B
- Does wordpress create activity, update logs?
- Display attachments by ID in a wp.media frame
- sort child pages on admin
- How-to make the admin area mobile friendly [closed]
- Use a separate custom table (not posts) to handle file upload data
- How to disable the “Your site has updated to WordPress x.y.z” admin email?