I am working on a local server on adding a media uploadbox to a Wordpress plugin Datafeedr Randam adds for a few days now and the code I have come up with so far is here http://wordpress.pastebin.com/xF0xs9mL . Code added to load needed scripts starts at line 101 and media upload html is located on line 354.
I have Been trying to get help at several places and did get some at #wordpress IRC. By changing the location of the script loading code - moving it to the top - things improved. Right now thickbox works and the media-upload box is loaded. I am stuck again though. Thickbox loads an empty box now instead of the media-upload details so I can upload images. One custom external javascript that is loaded into the plugin besides the WP nativity used JQuery and Thickbox I will post here:
jQuery(document).ready(function() {
jQuery('#upload_image_button').click(function() {
formfield = jQuery('#upload_image').attr('name');
tb_show('','media-upload.php?type=image&TB_iframe=true');
return false;
});
window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
jQuery('#upload_image').val(imgurl);
tb_remove();
}
});
Can anybody see why I get an empty thickbox and how this can be remedied? The fact that I see a 404 in the logs:
::1 - - [21/May/2010:09:00:56 +0400] "GET /wordpress/wp-admin/&random=1274418056878 HTTP/1.1" 404 16383
means the wrong page is loaded, but why?