I read out some of the tutorial for how to integrate the media uploader in wordpress plugins. I do the media uploader based on the tutorial.
http://wordpress.org/support/topic/howto-integrate-the-media-library-into-a-plugin?replies=4
I do this and it perfectly working. When i tried the same script again for multiple times of media uploader, Here is the fiddle i tried simply changed the id of the particular text field.
http://jsfiddle.net/UrXPe/1/
Still when i click the upload all is to be to done perfect. only thing if i click insert into post
it url of the image appear in the second browse field. Here is the screenshot what i face exactly.
When i click the first upload field (uploading process are success) after insert into post that corresponding media url is appear in the second field not in first. I am not sure where is the problem any suggestion would be great.
UPDATED – scroll down
After too much of hard work and research and some customization I coded below compact few lines of code to use media uploader anywhere in wordpress. Just put code in some function and call that function wherever you want.
The path of uploaded/selected file will be copied to text-box and then you can use it.
UPDATE: Just to add. You may need to add the function wrapper in your plugin/theme file. This is the following:
This will call the relevant JS files and CSS files if WP fails to load the upload manager. This also removes console warnings.
I’m using this method to use media uploader into my custom plugin.May be this would be help.
in the main theme file(index.php) add these.
In the admin_script.js file,
admin file(admin_settings.php),
More details in my blog
Use this in your custom plugin