How can i prefill a form with a file upload?

  • aholttest
    Asked on April 25, 2019 at 11:06 AM

    I have a (dynamic) file that I would like to pre-fill into the file upload field of a form when beginning the form process.  I tried using url parameters and just giving it a url for the file, but that did not seem to work.

    Jotform Thread 1803723 Screenshot
  • roneet
    Replied on April 25, 2019 at 1:52 PM

    You can't prepopulate a form field with a file for upload, due to the security context issues and sandboxes that are implemented to prevent websites from accessing your local files. So the method with URL prepopulating to a local file will not work, the file needs to be added by the user manually navigating to a file and selecting it from their system.

    May we know what is the reason for this? Why do you want to upload the file beforehand?

    Let us know your requirement so we may be able to suggest a possible workaround.

    Thanks.

  • aholttest
    Replied on April 25, 2019 at 2:01 PM

     I don't know why you would pre-populate it with a local file.  As you said that would effectively be impossible.  I'm talking about pre-populating it with a publicly accessible file URL.


    One possible use-case for this is to have a form that has been submitted by one user (say, a general user), then we can take the form data and pre-fill another form with it (including any files uploaded, via publicly-available urls) for an admin user to fill out additional fields (like admin-only fields used during processing) before final submission.


    This seems like it would be a pretty common use-case.

  • Richie JotForm Support
    Replied on April 25, 2019 at 3:23 PM

    To clarify do you want to use URL parameters to pre-fill the upload field?

    We can only get the URL file link but we cannot pre-fill the upload field using URL parameters.

    You may edit your submission so that you can upload new files.

    Here is a guide:https://www.jotform.com/help/325-How-to-Edit-Submissions-Made-on-Your-Forms

  • aholttest
    Replied on April 26, 2019 at 9:05 AM

     "We can only get the URL file link"


    okay, how do we do that?


    fyi, editing the submission is not the same as what I am asking.

  • roneet
    Replied on April 26, 2019 at 10:37 AM

    To pass the URL of the uploaded file to another Form you may do it by passing the unique name of the upload field to another Form URL.

    You have two forms

    Form 1: Users (or you) upload images

    How can i prefill a form with a file upload? Image 10

    Pass this unique name to the URL of the second Form:

    The second Form URL configured in the Thankyou page:

    http://form.jotformpro.com/form/91154663844967?uploadLink={upload}

    Form 2: Users selection of the images uploaded on form 1

    Here is a demo Form:

    https://www.jotform.com/91153760021951

    You can refer to this guide to prepopulate data from one Form to another:

    https://www.jotform.com/help/71-Prepopulating-Fields-to-Your-JotForm-via-URL-Parameters

    https://www.jotform.com/help/351-How-to-Automatically-Pass-Form-Data-to-Another-Form

    Let us know if this suffices your requirement.

    Thanks.


  • aholttest
    Replied on April 26, 2019 at 11:05 AM

    That is not a solution to my use-case.  The second form I would like to prefill is not being filled out by the original user, but a different user.

     

    It seems this is not supported.

     

    Thanks.

  • Richie JotForm Support
    Replied on April 26, 2019 at 12:14 PM

    We can pass the data field to another form and save the prefilled data URL in the thank you page/notification email or redirect the user to another form.

    Here is a guide:https://www.jotform.com/help/351-How-to-Automatically-Pass-Form-Data-to-Another-Form