Article
· Aug 22 1m read

How to download an image file from a web server using ObjectScript language

InterSystems FAQ rubric

The following code downloads http://www.intersystems.com/images/intersystems-header-logo.gif and saves the file as c:\temp\test.jpg.

 Set httprequest=##class(%Net.HttpRequest).%New()
 Set httprequest.Server="www.intersystems.com"
 Do httprequest.Get("/images/intersystems-header-logo.gif")
 Set httpresponse=httprequest.HttpResponse
 Set file=##class(%File).%New("c:\temp\test.jpg")
 Do file.Open("NWUK\BIN\")
 Do file.CopyFrom(httpresponse.Data)
 Do file.Close()
Discussion (0)1
Log in or sign up to continue