• Resolved bob2715

    (@bob2715)


    My Windows app creates a URL that will pre-populate several fields of my Forminator Form and this works as expected. A new requirement is to upload a pre-determined text file once in a while.

    App copies the local file location to the clipboard and executes the pre-populated URL. Form includes option to upload one file via field defined as:

    {upload-1}
    Field Labels:
    . Type: Single
    . Label: AttachFile
    . Description: Click Choose File, then Right-Click at the cursor and Paste

    I can’t find a tag that could be used to pre-fill the FileName. Ideally, I would rather pass the FileName to be uploaded and avoid confusing the user or opening the door for typing the path\filename which could lead to typos that fail to find the file.

    Is it wishful thinking or is there a way to populate the FileName so it would bypass the requirement for the user to click the Choose File button before seeing the FileName to be uploaded?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter bob2715

    (@bob2715)

    Sorry, forgot to mention that the file will always be a simple .txt file

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hi @bob2715

    Hope you are doing well today.

    Unfortunately, what you are doing to achieve is not possible because most modern browsers won’t allow you to change the file name or path while uploading a file, this is due to security reasons.

    If a website could auto-fill a file path, it could silently upload any file on the user’s computer without consent, passwords, documents, etc.

    Best Regards
    Amin

    Thread Starter bob2715

    (@bob2715)

    Thank you for your response. Sometimes it pays to think a question through before posting. Your explanation takes me back to the drawing board where I will search for a more elegant solution. Of course, security – both for my site and for the user will continue to be paramount in my considerations.

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @bob2715

    The issue is that the browser’s behavior cannot be changed, and this limitation is not related to the Forminator plugin.

    Instead, you could consider the following options:

    – Display the expected filename in a read-only text field, allowing the user to confirm it before uploading the file.

    – Have your Windows application upload the file directly to your server or the Forminator backend, bypassing the form UI entirely, which will require custom coding.

    – Create a custom upload endpoint and use Forminator solely for the metadata fields.

    Best Regards,
    Amin

    Thread Starter bob2715

    (@bob2715)

    Thank you for your response. I am not clear on the number of options you presented above.

    – Display the expected filename in a read-only text field, allowing the user to confirm it before uploading the file.
    * This I can easily accomplish (displaying the expected filename) and currently, I am placing the expected filename into the Windows Clipboard. The user can click the ‘Upload’ button and ‘Paste’ the expected filename into the File > Open field – which in turn will complete the Upload as required. the user gets to see the original filename location and that is fine as the user should always know from where a file is being uploaded.
    ? Are you suggesting that there is a way for the user to ‘confirm’ and thus ‘pass’ the read-only text field to the Upload process and thus avoiding typos or changes to the actual filename?

    • This reply was modified 5 months, 4 weeks ago by bob2715.
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @bob2715

    Not really but yes, sending the file name / path would help to locate the expected file.

    I also made further tests and unfortunately couldn’t find a different approach other than already mentioned by Amin.

    If you have the full access to the file that will be uploaded I would update the submission via custom endpoint as Amin mentioned.

    https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/#method-update_form_entry

    Best Regards
    Patrick Freitas

    Hi @bob2715

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Kind Regards,
    Kris

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.