Couldn\'t come up with a good title for this.
I\'ve got a build in WordPress where I have multiple image uploads using the built in WordPress media uploader. How it\
This is maybe a little bit old topic but following your solutions i made my plugin work. None of the code above didn't worked completely to my solution, but combining them i made it work. I needed to be able to have 2 upload fields and one to accept video files and other images, and to be able also to post images and videos in post edit screen.
jQuery(document).ready(function() {
var orig_send_to_editor = window.send_to_editor;
jQuery('.upload_image_button').click(function() {
formfield = jQuery(this).prev('input');
tb_show('Add Media', 'media-upload.php?type=file&TB_iframe=true');
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
if(jQuery(imgurl).length == 0) {
imgurl = jQuery(html).attr('href'); // We do this to get Links like PDF's
}
formfield.val(imgurl);
tb_remove();
jQuery('#'+formfield.attr('name')).val(imgurl);
window.send_to_editor = orig_send_to_editor;
}
return false;
});
});
And fields for upload are like this
You can also upload thumb from your PC using WordPress media manager(supported files are: .bmp, .BMP, .jpg, .JPG, .png, .PNG, jpeg, JPEG, .gif, .GIF).
You can also upload video to stream directly from your website, using WordPress media manager(supported files are: .mp4, .MP4, .flv, .FLV, .f4v, .F4V).
This way i can upload image with thumbnail field, and video with video field, and add various images or gallery in post edit screen also.
Later with php i check if proper extensions are in proper upload fields and save them in custom fields, if not it leave the fields empty.
Maybe some will find this useful as i found your answers useful and helpful to me.