I have a custom theme in which I created a download button where I call the Wordpress Uploader when these buttons are clicked. Something like that:
jQuery('#ahng_blog_upload_button').click(function() { formfield = jQuery('#ahng_blog_upload_image').attr('name'); tb_show('Upload or Select Photo and Click on "Insert into Post"', 'media-upload.php?type=audio&TB_iframe=true'); return false; });
Right now, in my functions.php folder, I set where I want the files to download ( http://website.com/wp-content/uploads ), but I want to change the download location depending on which button is clicked .
For example, when the "Download Image" button is clicked, change the download folder to images ( http://website.com/wp-content/uploads/images ), and when you click the "Download MP3" button, change the upload folder to audio ( http://website.com/wp-content/uploads/audio ).
I know that I can upload everything to the default folder that I mentioned earlier, but itโs easier to sort it later if I need to find a specific file using ftp.
Is there a way to do this with jquery and ajax and call a php file that actually returns nothing but makes changes to Upload Dir in wordpress? Or in any other way?
source share