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

    Trying to Curl the image from CSV address

    Asked by snaplash on November 19, 2015 at 11:51 AM

    I have an automated system and use the csv file to harvest my data from users submissions

     

    When a user submits an image the address in the csv is

     

    http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg

     

    I would like to use this address to curl the image to my system.

     

    However,

    the address is really

    https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg

     

    stopping my from curl ing the image, can you guys suggest a fix please?

     

    CSV curl Submissions JotForm uploads
  • Profile Image

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

    I presume you are referring to the PHP CURL operation.

    Kindly try using the following PHP code, the function takes two parameters.

    The URL of the image and the location the image is to be saved to.

    http://pastiebin.com/564e0dc48b991

    Also ensure that the allow_url_fopen is enabled in your PHP settings.

     

    Do let us know if this addresses your situation.

     

  • Profile Image

    Answered by snaplash on November 19, 2015 at 01:03 PM

    actually, I am using a shell script directly

  • Profile Image

    Answered by Sammy on November 19, 2015 at 01:20 PM

    I'm not very familiar with  using the CURL directive in shell scripts, I did manage to run an example fetching the image link provided over HTTPS using the following command and was able to download the file

    curl -o filename.jpg https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg

     

    Here is the screenshot, I ran it in windows. Kindly try and see if it executes correctly  on your end.

     

  • Profile Image

    Answered by snaplash on November 19, 2015 at 01:27 PM

    Yep, that works, but unfortunately that is not the problem. The address of the file in the CSV of the form is:

    http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg

    and that wont cURL because the file is located in

    https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg

     

    How do I get that address passed in my csv?

     

  • Profile Image

    Answered by Sammy on November 19, 2015 at 01:37 PM

    I do see the issue you are referring to now, on the browser the URL will be automatically redirected to the correct one but on CURL the redirection wont work.

    Kindly add the -L which is a location header flag, this will allow the URL to resolve correctly for your file, here is an example.

    curl -o filenameb.jpg -L http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg

     

  • Profile Image

    Answered by snaplash on November 19, 2015 at 01:38 PM

    Sammy! Thank you!

     

    That is perfect!

     

    M>

  • Profile Image

    Answered by Sammy on November 19, 2015 at 01:47 PM

    Happy to hear the solution works.

    If you do encounter any other difficulties feel free to let us know and we will happily assist.