FTP - download a GIF file 
Author Message
 FTP - download a GIF file

What object should I use to download a binary file (a GIF for instances) from a HTTP server?

I tryied:
var Inet1 = WScript.CreateObject("InetCtls.Inet");
Inet1.Execute "FTP://ftp.microsoft.com", "GET Disclaimer.txt C:\Temp\Disclaimer.txt"

and It is okay, but when I try
Inet1.Execute "FTP://ftp.something.com", "GET something.gif C:\Temp\something.gif"
I get a "Byte Array", as the de{*filter*} states, and I realy do not know what to do with it!

Thanks



Sun, 18 May 2003 03:00:00 GMT  
 FTP - download a GIF file
Here's a simple (and very fast) method (requires IE 5 or a separate install of the MS XML parser
plus ADO 2.5 or higher)...

sSource = " http://www.*-*-*.com/ ;
sDest = "c:\test.jpg"

Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

set oHTTP = WScript.CreateObject("Microsoft.XMLHTTP")

oHTTP.open "GET", sSource, False
oHTTP.send

set oStream = createobject("adodb.stream")

oStream.type = adTypeBinary
oStream.open
oStream.write oHTTP.responseBody
oStream.savetofile sDest, adSaveCreateOverWrite

set oStream = nothing

set oHTTP = nothing

WScript.Echo "Done!"

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

What object should I use to download a binary file (a GIF for instances) from a HTTP server?

I tryied:
var Inet1 = WScript.CreateObject("InetCtls.Inet");
Inet1.Execute "FTP://ftp.microsoft.com", "GET Disclaimer.txt C:\Temp\Disclaimer.txt"

and It is okay, but when I try
Inet1.Execute "FTP://ftp.something.com", "GET something.gif C:\Temp\something.gif"
I get a "Byte Array", as the de{*filter*} states, and I realy do not know what to do with it!

Thanks



Sun, 18 May 2003 03:00:00 GMT  
 FTP - download a GIF file
Thanks

Please, where can I learn some more about 'Microsoft.XMLHTTP' and
'adodb.stream' ?

Thanks again!



Sun, 18 May 2003 03:00:00 GMT  
 FTP - download a GIF file
XMLHttpRequest Object
http://msdn.microsoft.com/library/psdk/xmlsdk/xmld8bp0.htm

Stream Object (ADO)
http://msdn.microsoft.com/library/psdk/dasdk/mdao1ajx.htm

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> Thanks

> Please, where can I learn some more about 'Microsoft.XMLHTTP' and
> 'adodb.stream' ?

> Thanks again!



Sun, 18 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to download files from FTP SERVER in VBScript

2. Download some Files via FTP

3. download file without ftp

4. Download File via FTP/HTTP and other questions

5. Sought: ftp-address for Adobe windows ps-driver downloading

6. Automate FTP download

7. Write either batch or WSH script for FTP download

8. FTP Download

9. How to convert gif file in PS file

10. EPS Files to GIF Files?

11. gif->ps->gif

12. Download Files without File dialog box ?

 

 
Powered by phpBB® Forum Software