Upload images from media library programmactically
Posted by phponwebsites on February 24, 2015 at 9:20am
Normally we can upload images programmatically.
I enabled latest version of media module to upload images in wysiwyg. It is working fine. There is no problem. But i want to upload images programmatically from media library. That means, while clicking browse field, it opened pop up box to select/upload images from media library.
Below is my code.
function test_form_upload_form_alter(&$form, $form_state) {
$form['settings']['apply_now_image'] = array(
'#type' => 'media',
'#title' => 'Image for apply now',
);
$form['#submit'][] = 'test_upload_form_submit';
}