Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $form['folder_name'] = array(
  2. '#type' => 'textfield',
  3. '#title' => t('Folder Name'),
  4. );
  5. $form['document'] = array(
  6. '#type' => 'managed_file',
  7. '#upload_validators' => array('file_validate_extensions' => array('xml')),
  8. '#upload_location' => 'public://',
  9. '#submit' => array('custom_document_submit'),
  10. );
  11. function custom_document_submit($form, &$form_state){
  12. $destination = $form_state['values']['folder_name'];
  13. $validators = array();
  14. $file = file_save_upload('document', $validators, 'public://'.$destination);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement