I have a form which includes a file upload field.
A frm_validate_field_entry function on a following hidden field parses EXIF GPS metadata from the file upload via the attachmentID to fill itself (and some other preceeding hidden fields).
The problem is that sometimes (not always) functions that depend on reading the attached file just return blanks, as if the form has already completed POST before the function has returned so the attached file handle is no longer valid.
ALTHOUGH the function variables which point to the file still return values:
$attachment_id = $_POST['item_meta'][$upload_field_id];
$attachment_handle = get_attached_file($attachment_id);
... in the error condition using them returns nothing:
$exifdata = @exif_read_data($attachment_handle, 0, false, false);
Moving the hidden field with its parsing function up the form helps reduce the incidence, but it is not a 100% solution as I still see frm_after_create_entry triggering in a debug log BEFORE the frm_validate_field_entry field function has completed causing the blank returns.
TL;DR: is there any way of stopping/blocking/locking an entry being created and clearing handles BEFORE all frm_validate_field_entry functions have completed ?
ps apologies for double spacing, this editor seems to ignore simple CRs.
Good call, unfortunately its already the lowest add_filter priority on that server/script at 10, all others are higher at 20, 30, 40.
You can set priorities lower than 10. 10 is only the WordPress default.
Another thought..., does you form have embedded forms for repeaters? They get processed first before the main form.
No its simple upload file and fill in a couple of fields/sliders page.
Please login or Register to submit your answer