1

I have created a form with a file attachment field. I have noticed that users will attach a file but sometimes forget to hit the upload button. I would like the form to automatically upload the file when the form submit button is pressed (if a file has been selected to upload).

I have seen a similar answer answer to this at https://drupal.stackexchange.com/a/31453/4471 but that is a slightly different use case then what I am after. I would have thought that submitting a form would automatically upload attached files as default behaviour.

I am working with Drupal 7 by the way.

Thanks.

1

If a file has been selected in a file upload field, it will be uploaded on form submit regardless of whether the "Upload" button has been pressed.

  • After checking form_state more closely, I see the value is set in 'complete form' section but not in the 'input' section where I was expecting the result to be. I would consider this a bug in drupal. The input field should be updated to reflect that the file has been uploaded. – user5013 Mar 13 '13 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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