Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Download image (jpg) from URL using DotNet

$
0
0
Hi,

can anyone help me to post a code snippet to download an image from a URL using DotNet in NAV 2016?

I've tried with this code but it doesn't work.
LOCAL DownloadRemoteFile(URL : Text;LocalFilePath : Text)
WebRequest := WebRequest.HttpWebRequest;
WebRequest := WebRequest.Create(URL);
WebResponse := WebRequest.GetResponse;

Bytes := WebResponse.GetResponseStream;
MemoryStream := MemoryStream.MemoryStream(Bytes);

FileMode := FileMode.Create;
FileAccess := FileAccess.Write;
FileStream := FileStream.FileStream(LocalFilePath,FileMode,FileAccess);
MemoryStream.WriteTo(FileStream);
:blush:
Variables
WebRequest@1000000003 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.HttpWebRequest";
WebResponse@1000000002 : DotNet "'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Net.WebResponse";
MemoryStream@1000000010 : DotNet "'mscorlib'.System.IO.MemoryStream";
FileStream@1000000004 : DotNet "'mscorlib'.System.IO.FileStream";
FileAccess@1000000007 : DotNet "'mscorlib'.System.IO.FileAccess";
FileMode@1000000006 : DotNet "'mscorlib'.System.IO.FileMode";
Bytes@1000000008 : DotNet "'mscorlib'.System.Array"

Thanks

Viewing all articles
Browse latest Browse all 10032

Trending Articles