What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    Using Sinatra with Webhook to retrieve the url of one file upload

    Asked by jdelgado on November 19, 2015 at 11:40 AM

    I am trying to obtain the url direction of a file (uploaded) located in jotform. I use Sinatra in the Backend to control the /POST for jotform, the webhook is already working and i receive the response from jotform.

    The response has a format that i can not parse in ruby using JSON.parse(body.request.read). I think it happens because of the format used in that object. So i want to know what is the format of that object to parse into an json object and retrieve the url with the location of the file.

    Example of the request.body.read without the parsing:

    $ rackup -p 8080 launch_server.rb 

    [2015-11-19 11:52:24] INFO  WEBrick 1.3.1

    [2015-11-19 11:52:24] INFO  ruby 2.1.2 (2014-05-08) [x86_64-linux-gnu]

    == Sinatra (v1.4.6) has taken the stage on 4567 for development with backup from WEBrick

    [2015-11-19 11:52:24] INFO  WEBrick::HTTPServer#start: pid=9081 port=4567


    Content-Disposition: form-data; name="formID"




    Content-Disposition: form-data; name="submissionID"




    Content-Disposition: form-data; name="webhookURL"




    Content-Disposition: form-data; name="ip"



    Content-Disposition: form-data; name="formTitle"


    Upload Files


    Content-Disposition: form-data; name="pretty"


    Full Name: , E-mail:, Order :, ID:28, Upload your Prescription:Screenshot from 2015-09-19 08:58:09.png


    Content-Disposition: form-data; name="username"




    Content-Disposition: form-data; name="rawRequest"


    {"slug":"submit\/53165035132647\/","q5_fullName5":{"first":"","last":""},"q7_email7":"","q8_order8":"","q10_id":28,"preview":"true","event_id":"1447950157883_53165035132647_fnvutIt","q1_uploadYour":["http:\/\/www.jotformz.com\/uploads\/jdelgado\/53165035132647\/323759367249625573\/Screenshot from 2015-09-19 08_58_09.png"]}


    Content-Disposition: form-data; name="type"




    localhost - - [19/Nov/2015:11:52:50 VET] "POST /webhook/heywatch HTTP/1.1" 200 0

    - -> /webhook/heywatch


    Thanks beforehand!

    Page URL:

  • Profile Image

    Answered by victor on November 19, 2015 at 01:01 PM

    I'm sorry but not truly familiar with Sinatra and webhook. I was able to locate a small sample on the web on how to send and receive request through POST:


    To get the URL of any upload file, you can use the following code sample

    $url = "http://www.jotform.com/uploads/Account_Username/".$formid."/".$submission_id."/".$upload;

    Please let us know if this helps.