Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using shdocvw.dll to download a file -gives error

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I am using code that wraps shdocvw.dll to download a file from my server.

The file is in the root directory of my server.

The operation tries to operate correctly as a dialogue appears but with an error message. see below.

<code>

sURLandFile = "ftp://upgrader:nnnnn@mysoft.soho.on.net/PW9Setup.exe ";

sURLandFile = HandleUnsafeChars(sURLandFile)

IF !EMPTY(sURLandFile)
nRet=DoFileDownload(STRCONV(sURLandFile,5))
ELSE
ENDIF

</code>

Error.

Looking at the transaction in wireshark I see the login succeeds and it attempts to grab the file but shows
CWD /PW9Setup.exe\357\274\200\357\277\277\353\265\233\347\253\274\343\217\272\340\240\200/
FTP Response: 550 /PW9Setup.exe?: No such file or directory

On my screen I get the usual dialogue with
Getting File Information:
PW9Setup.exe(then some chinese chrsthen ..from mysoft.soho.on.net

On top of that I get another dialogue Titled - Web Browser

Unable to download (then the msg line above)
The server returned extended information.

Has anyone any experience with this and might be able to give me a clue what is going wrong?

Thanks

GenDev

 
I forgot to give this line at the top of the prg file

Declare DoFileDownload IN shdocvw.dll STRING lpszFile
 
We just recently discussed possibilities of file download, take a look at thread184-1658276.

Bye, Olaf.
 
Besides that, DoFileDownload only expcts a URL. target="_blank" is HTML and not part of the URL, an FTP-URL containing the login credentials looks like "ftp://user:pass@ftp.server.com/.../PW9Setup.exe"

And by the way: Using the MsXml2.XmlHttp solution from the other thread you can't downbload from FTP, it's a HTTP class only. Not so sure about Mikes suggested Internet Transfer Control or URLDownlodToFile. You perhaps better make use of VFPConnection to download from FTP.

Bye, Olaf.
 
Not so sure about Mikes suggested Internet Transfer Control or URLDownlodToFile.

Yes, you can use the Internet Transfer Control to do FTP. But not the OpenURL() method I suggested in the other thread. Instead, you use the Execute() method, passing the URL and the FTP command that you wish to execute:

Code:
lox = CREATEOBJECT("inetctls.inet")
lox.Execute("nnnnn@mysoft.soho.on.net", ;
  "get PW9Setup.exe c:\myfiles\PW9Setup.exe")

But this doesn't address the login issue in the original question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top