|
-
Oct 21st, 2008, 09:56 PM
#1
Thread Starter
Addicted Member
Another Inet question
Hi gurus
I have so far the following code:
Code:
Dim localname As String
Dim remotename As String
localname = "c:\testfile.txt"
remotename = "testfile.txt"
With Inet1
.Url = "ftp://Ftp.theirsite.com/"
.Username = "myusername"
.Password = "mypassword"
.Execute , "CD /myfolder_within_their_ftp"
finishcmd ' This call for a do while inet.stillexecuting
.Execute "", "PUT " & localname & " " & remotename
finishcmd
End With
Inet1.Execute , "CLOSE"
But nothing happens, I get no error, the appl. ends fines but the files does not upload from my server to their server.
I dont know if my cd is not necessary, as when I log in to their FTP site I am taken directly to my folder within their FTP server.
Thanks for any help, I know I am missing something but I dont know what is it
Thansk a buncH again
-
Oct 21st, 2008, 10:00 PM
#2
Frenzied Member
Re: Another Inet question
Try setting the protocol property to 2
-
Oct 21st, 2008, 10:37 PM
#3
Thread Starter
Addicted Member
Re: Another Inet question
Z.
Thanks a bunch
It still does not do anything, the process ends ok with no errors but no file uploaded either.
Thanks
-
Oct 22nd, 2008, 06:10 AM
#4
Re: Another Inet question
You need quote marks around the path/filenames. So change it like this:
Code:
Dim localname As String
Dim remotename As String
localname = Chr(34) & "c:\testfile.txt" & Chr(34)
remotename = Chr(34) & "testfile.txt" & Chr(34)
'
'
'
-
Oct 22nd, 2008, 06:50 AM
#5
Thread Starter
Addicted Member
Re: Another Inet question
JM
Thanks for jumping in.
so do you mean that the string should look like this ""c:\testfile.txt""
Thanks
-
Oct 22nd, 2008, 06:58 AM
#6
Re: Another Inet question
You were sending this command:
PUT c:\testfile.txt testfile.txt
but the server needs to see it like this:
PUT "c:\testfile.txt" "testfile.txt"
-
Oct 22nd, 2008, 03:31 PM
#7
Re: Another Inet question
no it would look like
"""c:\testfile.txt"""
only essential to do this if the file name does /can contain spaces
i tried the inet code and successfully uploaded a txt file, but it took a few goes to get all the settings right, and no error messages to point to problems, so you just have to persevere until you can get it to work
you need to get the server responses, so you can tell what is happening on your connection
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 22nd, 2008, 03:45 PM
#8
Re: Another Inet question
westconn, """c:\testfile.txt""" is the same as what I posted in #4
localname = Chr(34) & "c:\testfile.txt" & Chr(34) which results to what I posted in #6 PUT "c:\testfile.txt" "testfile.txt"
only essential to do this if the file name does /can contain spaces
Not always so. I have two FTP servers I deal with; one only takes the parameter as I stated it. If I try to either GET or PUT without quotes around the file/path names then the server will not perform the request (just like OP's problem) but when I add the quote marks then the server does the request.
Last edited by jmsrickland; Oct 22nd, 2008 at 04:17 PM.
-
Oct 22nd, 2008, 09:45 PM
#9
Thread Starter
Addicted Member
Re: Another Inet question
Thanks gurus, it worked like a charm
1) how can I implement in my code StateChanged event, so I can keep track of the FTP connection and create a log.
Thanks and sorry for the low ball after all your help.
Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|