I have standard input form for custom content (for example, /node/add/page and /node/%/edit) with image-field in which you can upload multiple photos. How to get the full URL addresses of all the photos when user add new content or editing old one (delete or upload extra photos)?

1 Answer 1


I implemented it this way. Hopefully this will save someone's time. The code works well if you upload files, delete if it works after the removal of the second file in this list and removes only the first remote URL.

function testmodule_form_page_node_form_alter(&$form, &$form_state, $form_id) {
    $form['field_photo']['#element_validate'][] = 'my_function';

function my_function($element, &$form, &$form_state){

        $lang = $element['#language'];
        foreach (element_children($element[$lang]) as $key) {
                $fid = $element[$lang][$key]['#value']['fid'];
                $file = file_load($fid);
                $url = file_create_url($file->uri);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.