How do I get the file upload URL from POST data?

  • Profile Image
    PEvaluations
    Asked on February 16, 2015 at 08:33 AM

    If a form has a file upload (e.g. a photo) POST does not seem to include the URL to the file, just the name (e.g. photo.png). Is the submission ID available in the POST also? Perhaps that way I can use the API to pull the photo URL.



    This is a re-post of a comment on Send Submission Data via Post Method and Thank You Settings

  • Profile Image
    Kiran
    Answered on February 16, 2015 at 10:30 AM

    It is possible to get the submission ID from the POST data. I notice that the only file name is displayed in the POST data. However, since the files uploaded URL is similar and having the form ID, submission ID we can generate the file uploaded URL as below :

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

    Here $formid, $submission_id and $upload are the variables to store the respective data from POST data.

    For instance, the URL can be generated as below by concatenating these variables.

    http://www.jotform.com/uploads/Kiran/50463987461969/299908918475243156/This is a test image.jpg

    If you are allowing multiple files on the upload button, the upload field turns to an array.

    Please take a look at the following demo form that displays the POST data and the generated URLs for both upload fields. 

    http://form.jotformpro.com/form/50463987461969?

    Hope this information helps. Please get back to us if you need any further assistance. We will be happy to help.