I've got a custom theme that I've created an upload button where I call the Wordpress Uploader when these buttons are pressed. Something like this:
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've set where I'd like the files to Upload (http://website.com/wp-content/uploads
) but I want to change the Upload location depending on which button is pressed.
For example, when the 'Upload Picture' button is pressed, change the upload folder to images
(http://website.com/wp-content/uploads/images
), and when the 'Upload MP3' button is pressed, change the upload folder to audio
(http://website.com/wp-content/uploads/audio
).
I know I can upload everything to the default folder which I mentioned previously, but it's easier to sort through later if I need to look for a specific file using ftp.
Is there a way to do that using jquery and ajax and calling a php file that doesn't really return anything but makes changes to the Upload Dir in wordpress? Or any other way?