
A Contact Form 7 integration can enqueue a background job successfully and still lose the uploaded document before the worker starts. The mistake is often a lifetime mismatch: the queue stores a path to a temporary file, while CF7 removes that file after its mail procedure. Delaying the worker makes an unreliable design visible; it does not create the underlying problem.
This guide is for developers designing a custom deferred handoff. It does not provide a drop-in upload plugin or claim that CF7 Analytics stores documents. Use synthetic files in staging and review the installed connector’s actual behavior before changing a live workflow.
Separate temporary upload storage from job storage
CF7’s official upload documentation describes validation, movement to a temporary directory, attachment to mail and removal after those procedures. A local path that exists during submission handling is therefore not a durable document reference.
Our upload-field guide covers configuring the field and mail attachment. The separate question here is what a worker can read after the originating request has finished. Document that boundary before choosing a queue or adding a retry policy.
Write a simple requirement: an accepted document must remain available to the intended worker until the handoff succeeds or the approved retention deadline expires. Include who owns that storage and how a failed handoff reaches a person who can resolve it.
Inspect what the connector actually enqueues
Read the connector’s documentation and implementation for the installed version. Does its queue record contain the temporary pathname, file bytes, a durable object identifier or an attachment record? A friendly filename in the job monitor does not answer this question. Inspect a synthetic job’s stored structure without exposing real documents or credentials.
Also establish when the file becomes available and when cleanup occurs in that version’s submission lifecycle. Do not assume that every PHP hook provides the same data at the same time. Select a supported extension point after validation and before removal, with a maintainer responsible for compatibility after CF7 updates.
Complete a durable handoff before acknowledging it
A reviewed implementation can copy the validated upload into an approved private storage area, verify the copy, then enqueue a small reference to it. Use a generated internal object key rather than trusting a visitor-supplied filename as a path. Keep a safe display filename separately if the receiving process needs it.
Verify size and, where appropriate, a content hash before considering the copy complete. Only expose the completed object reference to the worker. If the copy fails or storage is unavailable, record a failed handoff instead of creating a job that can never read its input.
The WordPress upload-directory API returns filesystem paths and URL information. Choosing that directory does not itself make a file private. Review the storage area’s HTTP access and serving mechanism separately; confidential lead documents should not become guessable public download URLs.
Give the worker a usable reference
A path on the web server is not necessarily available inside a worker container or another machine. Record whether the worker reads a shared private filesystem, downloads an authorized storage object or calls a reviewed document service. Test with the same execution identity and storage permissions used by the worker.
Queue only the metadata necessary to locate and process the object. Avoid embedding file contents in broadly readable job dashboards or logs. Keep credentials in the normal service configuration rather than in each job payload. A queue entry should not grant permanent document access merely because it was copied into a support ticket.
Make retries and deletion work together
Assign a stable document or operation identifier so a retried job can recognize an already completed transfer. A worker crash after the receiver stores a document but before the queue acknowledges success is a distinct case from a transfer that never began. Review the receiver’s duplicate-handling contract.
Define when local durable storage can be deleted. Successful remote receipt may justify cleanup, but an uncertain response should enter reconciliation rather than automatic deletion or endless retention. A failed job also needs a deadline and an escalation owner. Deliberately removed objects should leave a minimal non-sensitive status record, not a broken path that looks like an unexplained runtime error.
Choose a queue only after this lifecycle is clear. Our background-job comparison discusses worker infrastructure; no queue can recover a document that was removed before it read the bytes.
Test after the original request has ended
Create a harmless document with a recognizable synthetic marker. Delay the worker until after CF7 completes the submission request. Confirm that the worker still reads the expected bytes and that the receiving system can open the resulting document. Check the copied object’s hash rather than relying only on its filename.
Repeat with unavailable storage, a missing object, worker restart, duplicate delivery and an expired retention deadline. Record expected outcomes before running the cases. Keep these checks isolated from real mail recipients and customer records.
Finally, distinguish technical submission success from document receipt. WordPress documents that a successful wp_mail result is not proof of recipient delivery. Our Svetlik Analytics plugin can complement submission reporting, but durable file handling and receiver verification remain separate responsibilities.
