TheChos
asked on
Upload a file using Inet
I'm having trouble uploading a file to an FTP site using the Inet control in VB. The code that I'm using below allows me to log into the site and download files but doesn't work when I try to upload a file. Any ideas as to what I'm doing wrong? Thanks in advance.
strFile = "test.txt"
inetUpload.Protocol = icFTP
inetUpload.URL = "88.25.125.25"
inetUpload.UserName = "ftpusername"
inetUpload.Password = "ftppassword"
inetUpload.Execute inetUpload.URL, "CD testdir\subdirectory"
inetUpload.Execute inetUpload.URL, "Get " & strFile & " C:\temp\" & strFile
Do While inetUpload.StillExecuting
Timeout 1
Loop
strFile = "c:\temp\test.txt"
inetUpload.Execute inetUpload.URL, "SEND " & strFile & " sentfile.txt"
Do While inetUpload.StillExecuting
Timeout 1
Loop
strFile = "test.txt"
inetUpload.Protocol = icFTP
inetUpload.URL = "88.25.125.25"
inetUpload.UserName = "ftpusername"
inetUpload.Password = "ftppassword"
inetUpload.Execute inetUpload.URL, "CD testdir\subdirectory"
inetUpload.Execute inetUpload.URL, "Get " & strFile & " C:\temp\" & strFile
Do While inetUpload.StillExecuting
Timeout 1
Loop
strFile = "c:\temp\test.txt"
inetUpload.Execute inetUpload.URL, "SEND " & strFile & " sentfile.txt"
Do While inetUpload.StillExecuting
Timeout 1
Loop
Thats because your file has a space in it
inetUpload.Execute inetUpload.URL, "SEND " & strFile & " sentfile.txt"
change to ::
inetUpload.Execute inetUpload.URL, "SEND " & strFile & "sentfile.txt"
inetUpload.Execute inetUpload.URL, "SEND " & strFile & " sentfile.txt"
change to ::
inetUpload.Execute inetUpload.URL, "SEND " & strFile & "sentfile.txt"
instead of using the inet control why dont u have a look at my project is uses all API
go here:::
http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=60125&lngWId=1&txtForceRefresh=421200520391293201
go here:::
http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=60125&lngWId=1&txtForceRefresh=421200520391293201
ASKER
Yes, I am open to alternate methods for uploading a file.
Use FTP API, if you download my project everything is there on how to connect using FTP API. This way you dont need to ship any controls with your project.
ASKER
egl1044,
I'm getting the same results using your code. I can download files but am unable to send a file. Do you know of an FTP site that I could use to test my code? I would like to verify that our security isn't causing the problem.
I'm getting the same results using your code. I can download files but am unable to send a file. Do you know of an FTP site that I could use to test my code? I would like to verify that our security isn't causing the problem.
Make sure you set the settings in the UPLOAD button. make sure you username and password are correct and the ftp server.
To test this create a free account at::
www.angelfire.com
To test this create a free account at::
www.angelfire.com
If you set up your IP address to act as a FTP site then I would make sure you ftp program that creates the ftp site is set to accept uploaded files. You might have the option to write data to ftp server disabled and only have get data enabled.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked! It appears as though security is the issue. I still can't upload to the site that I want to but I can upload to other sites. I'll talk with my administrator to straighten it out. Thanks for all you help.
...I think I said something similar :)
Presumably you've tried another FTP client to see if you do, in fact, have write priviledges to the area?
Are you specifically looking to use the Inet control, or are you open to alternate methods?
BFN,
fp.