Skip to main content
edited title
Link
Srihitha Narra
  • 653
  • 1
  • 6
  • 15

How to saveread file submitted through file field in block configure form

Source Link
Srihitha Narra
  • 653
  • 1
  • 6
  • 15

How to save file submitted through file field in block configure form

I have created a block through custom module and added file field in block configuration form using below code.

function mymodule_block_configure($delta){
if($delta=='mymodule'){
    $form = array();
    $form['mymodule_file']=array(
        '#type'=>'file',
        '#title'=>'Upload text file',
        '#name'=>'files[sample]',
        
    );      
    return $form;
      }
 }

When I try to check this field in hook_block_save, the form element is empty even when the form is submitted after browsing the file.

 function mumodule_block_save($delta,$edit=array()){
    if($delta=='mymodule_block'){
    dpm($edit); 
    }
     }

$edit['mymodule_file'] is empty after the form is submitted.

Am I missing anything?