My.Computer.Network.UploadFile error

G

Guest

THE FOLLOWING CODE:

Dim strUpLoadFile As String
Dim siteUri As New Uri("ftp://wxyz.com/UpLdTest.zip")
strUpLoadFile = "C:\Trash\UpLdTest.zip"
My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg",
1000)

PRODUCES THIS ERROR:

Unable to cast object of type 'System.String' to type
'System.Net.ICredentials'.

THE ERROR POINTS TO THE USERNAME PARAMATER AS THE SOURCE OF THE ERROR. I'M
GUESSING THE PASSWORD PARAMETER WOULD PRODUCE AN ERROR ALSO.
WHAT IS THE CORRECT CODE TO UTILIZE My.Comp....work.UploadFile?
Thanks for your help.
 
G

Guest

John Brown said:
My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg",
1000)

The specified signature you're using doesn't exist, you're trying to use:
sourceFileName ,address ,userName ,password, connectionTimeout
but the only two close signatures are either:
sourceFileName ,address ,userName ,password
or
sourceFileName ,address ,networkCredentials ,showUI ,connectionTimeout

..NET thinks you're using the latter, and so thinks your username should be
of type ICredentials.

Remove the last parameter from your call:
My.Computer.Network.UploadFile(strUpLoadFile, siteUri, "johndoe", "abcdefg")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top