I'm working on a form that allows users to submit several files. I have a form created that includes several managed files. I need a way to process the file after it's been uploaded to ensure that it contains the data I need. Is there a way to do this? All the code I've seen on the internet talks about processing files but doesn't show to call the code in the first place.

My form element looks like this:

$form['commlink_fid'] = array(
  '#type' => 'managed_file',
  '#title' => 'The file to upload',
  '#default_value' => variable_get('commlink_fid',''),
  '#upload_location' => 'private://uploaded_files/',
  '#upload_validators' => array(
    'file_validate_extensions' => array('zip'),
  • "I need a way to process the file after it's been uploaded" - what do you mean by "after" - when exactly? Commented Jun 23, 2013 at 23:02
  • I need to inspect the file right as it's uploaded and before the end user submits the form.
    – Robbert
    Commented Jun 24, 2013 at 16:53


Your Answer

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

Browse other questions tagged or ask your own question.