Is there a way to preselect a local file for upload via URL?

  • t2med
    Asked on June 18, 2015 at 4:22 AM

    Dear support,

    is there a way to preselect a local file for upload via URL, like I tried in this example?

    https://secure.jotformeu.com/form/50843592116354?vollstandigerName9[first]=Frank&vollstandigerName9[last]=Testomat&ihrProblem=delicate problem&email8=frank.testomat@mail.com&ausfuhrlicheProblembeschreibung=This is a lot of text describing the nature of the problem. See attached screenshot!&fugenSie1=@/temp/screenshot.png

     

    Alternatively: Is there a way to prefill the form and upload a file using the curl tool?

    curl -F vollstandigerName9[first]="Frank" -F vollstandigerName9[last]="Testomat" -F ihrProblem="delicate problem" -F email8="frank.testomat@mail.com" -F ausfuhrlicheProblembeschreibung="This is a lot of text describing the nature of the problem." -FfugenSie1=@/temp/screenshot.png https://secure.jotformeu.com/form/50843592116354

     

    Many thanks in advance!

  • Boris
    Replied on June 18, 2015 at 6:13 AM

    Hello.

    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 user manually navigating to a file and selecting it from their system.

     

    When it comes to using curl to submit a form with your local file, please take a look at our documentation page to see if this is what you are trying to accomplish:

    http://api.jotform.com/docs/#post-form-id-submissions

    You will need to create an API Key on the API tab of your account page, as explained at the top of the documentation: http://api.jotform.com/docs/#gettingstarted

    Please let us know how it goes.

  • t2med
    Replied on June 18, 2015 at 6:35 AM

    Hello.

     

    Thank you for your answer!

    How does this work in case of file upload fields?

    That does not seem to be easy, as can bee seen here:

    http://www.jotform.com/answers/289835-How-to-submit-form-with-file-upload-field-using-API-PHP-

  • Ben
    Replied on June 18, 2015 at 9:03 AM

    I would just like to confirm if you are now looking for a way to use the cURL to post the field data and the file to the jotform?

    If so, please note that you can not have that code pre-fill the file to submit for your users. It would only be an option that you could use if you are looking to submit the file yourself, or from few different devices, that you are administrator of.

    To best help you, I would like to ask you to give us more details as to why you would like to pre-populate the file to be uploaded as that would give us enough details to know how to best help you.

  • t2med
    Replied on June 19, 2015 at 10:49 AM

    Many thanks for your answer. I have now deployed a standard HTML form on our own webserver and use cURL to submit form data and a file via shell script.

    It is a tool for our support to submit application logfiles including some basic data without the need for our customers to manually attach the log files to the form.

    So the form is used manually and via mouse click.

  • Ben
    Replied on June 19, 2015 at 11:55 AM

    If I have understood you correctly you have a form (not a jotform) on your webserver and you have set the form to submit the data of it to the jotform over a shell script.

    Now the second part is something that I am having trouble understanding, you are receiving the files from your customers through some app / application that is automatically sent to your server and that is the file that you would like to send to your jotform?