Skip to content

Fix multiple custom file upload fields#2929

Merged
Armanul46 merged 1 commit into
sovware:developmentfrom
Arafat-plugins:fix/multiple-file-upload-invalid-request
Jul 23, 2026
Merged

Fix multiple custom file upload fields#2929
Armanul46 merged 1 commit into
sovware:developmentfrom
Arafat-plugins:fix/multiple-file-upload-invalid-request

Conversation

@Arafat-plugins

Copy link
Copy Markdown
Contributor

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

How to reproduce the issue or how to test the changes

This fixes custom File Upload fields after the first field failing with an "Invalid upload request!" response on new listing submission forms.

Each custom File Upload field generates a separate security token tied to its directory and field key. However, the Plupload initializer reads the first global atbdp_plupload_params configuration for every uploader. The second and subsequent uploaders therefore submitted the first field's token with their own imgid, causing the server-side field/token validation to reject the request.

This change exposes each field's token on its own uploader container and assigns that token to the corresponding Plupload request during the existing initialization loop. The original base configuration remains as a fallback for backward compatibility. No additional requests, database queries, or event listeners are introduced.

  1. Go to Directorist -> Directory Builder and add at least three separate File Upload fields to a submission form.
  2. Configure the fields to accept PDF files and save the directory.
  3. Open the frontend new-listing form where no listing post ID exists yet.
  4. Upload a valid PDF to the first, second, and third File Upload fields.
  5. Confirm every upload completes without the "Invalid upload request!" error.
  6. Verify each AJAX payload contains:
    • action=atbdp_post_attachment_upload
    • the field-specific imgid
    • the matching field-specific upload_token
  7. Confirm a form containing only one File Upload field continues to work.

Any linked issues

Screenshot

Checklist

  • My code follows the WordPress coding standards
  • The source and production Plupload bundles have been updated.
  • The focused production bundle builds successfully.

@Armanul46 Armanul46 added this to the v8.8.8 milestone Jul 20, 2026

@RabbiIslamRony RabbiIslamRony left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

@Armanul46
Armanul46 merged commit 318a7e7 into sovware:development Jul 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants