Score:0

Webform File Attachments Uploaded But Not Linked to Submission

us flag

I have Webform 6.1.5 running in a D9.5 website, that has lots of other contrib modules.

Using the Webform Attachments sub-module I have some simple forms that require files to be attached to the submission. The files are being uploaded [to the temporary _sid_ folder] but not to the submission folder once the webform is submitted, nor are the files referenced in the submission. If 'preview' is enabled, the files are not visible in the preview.

Conversely, using the Webform 'Test' function, sample file attachments are uploaded and added to the submission, which is the correct behaviour.

I cannot reproduce this behaviour on a vanilla D9.5 installation, so it looks like there's a conflict [with another module] that's crept in, and I'm not sure how best to approach this. So I'd welcome any suggestions.

Things I have checked:

  • Private and Temporary files folder permissions - all fine
  • Private folder path changed from relative to absolute - no change
  • Disabled multi-language and translation modules and config (see https://www.drupal.org/project/drupal/issues/2797639 - now fixed, but you never know).
  • Changed permissions (both via Webform Access and core 'View own webform' permission)
  • Added (private) file upload to Content type - works fine and is downloadable.
  • Looked at other file upload systems - DropzoneJS and Plupload - but additional modules required to work with Webform.
  • Installed all the Webform libraries (rather than coming from CDN). No change
  • Checked PHP and DB resource settings (max_allowed_packet, max_input_vars, post_upload_size etc) - seem adequate and have added a bit more to check.
  • Have enabled Webform 'Debug' handler - file fields in submission are empty
  • No JS errors posted in the Console (EDIT: also disabled JS in browser; no change observed)
  • Have tried disabling lots of modules, especially those that could have an impact on file handling or forms; however, not much left now and no change observed.
  • There's this issue that looks similar (https://www.drupal.org/node/3118815) but there was never any follow up.
  • EDIT: also tried system in default front-end and admin themes
  • EDIT: Also uninstalled Webform module, then re-installed and created simple form with File Upload field. No change - so clearly not an issue with Webform default config.

I'm not sure where to to insert some breakpoints in the module code. Looking at webform/src/WebformSubmissionInterface.php it looks like all the functionality is inherited from Core ContentEntityInterface and EntityOwnerInterface... or whether this is a JS issue.

id flag
I am the author of https://www.drupal.org/node/3118815. Is there a load-balancer?
Rob Carr avatar
us flag
No there isn't any load balancing or caching (inc BigPipe) when behaviour observed. Same behaviour on QA/production servers and local dev.
us flag
You might want to try moving the file temp directory to a different location and see if that is the issue.
us flag
Are simple webform element file uploads working as expected?
Rob Carr avatar
us flag
No they're not. Emails/attachment issues was the first problem to pop up, and the root cause is that no files are associated with the submission (file fields are 'null' on preview/submission)
Rob Carr avatar
us flag
Changing the site Private and Temporary directories to different locations made no change. Also set config to allow Public directory uploads. Same 'null' file behaviour.
id flag
Is everything on the same file system?
Rob Carr avatar
us flag
Thanks @cilefen - currently all in the same file system (at least on local and QA)
Score:-1
us flag

Unfortunately, there is no answer.

I ripped the entire site apart, deleting most content and config, leaving just Webform and Core modules enabled, yet the problem persisted. Then I deleted the contents of all /core, /vendor, /libraries and /modules/contrib directories, then rebuilt via Composer. A few updates were pulled down for contrib and vendor files, then the file upload worked correctly.

Thank you for those that helped or suggested ways to tackle this.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.