- snaplashAsked 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
I would like to use this address to curl the image to my system.
the address is really
stopping my from curl ing the image, can you guys suggest a fix please?
- SammyAnswered 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.
Also ensure that the allow_url_fopen is enabled in your PHP settings.
Do let us know if this addresses your situation.
- snaplashAnswered on November 19, 2015 at 01:03 PM
actually, I am using a shell script directly
- SammyAnswered 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.
- snaplashAnswered 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:
and that wont cURL because the file is located in
How do I get that address passed in my csv?
- SammyAnswered 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
- snaplashAnswered on November 19, 2015 at 01:38 PM
Sammy! Thank you!
That is perfect!
- SammyAnswered 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.