Using VB6 to upload files to my GODADDY-hosted FTP
My vb6 app CREATES a .html file. My goal is then to upload this file to my FTP.
Here's what I tried using:
1- Inet
2- Winsock
3- Batch files!
With Inet and Winsock, the connection works, and the uploaded file IS INDEED created in the specified directory, BUT is always empty. 0bytes. I could paste some code upon demand, but to be quite honest, I've tried many different code found and it always comes down to the same problem... I suppose the problem is elsewhere. I have no firewall interfering. Also, some people, under GODADDY, had success after switching to CPanel hosting but it didn't seem to help here.
Then I've tested a simple batch file:
Code:
open ftp.my_domain.com
mylogin
mypassword
lcd C:\testfolder
cd /mysite
binary
delete mytextfilename.txt
mput mytextfilename.txt
disconnect
quit
...everything seems to be working until I hit the mput command, which results in "200 PORT command successful", quickly followed by "425 Could not open data connection to port 59501: No route to host".
So I'm having trouble achieving, honestly, something I thought would be very simple. Are there any limitations with GODADDY? Any ideas?
Re: Using VB6 to upload files to my GODADDY-hosted FTP
I don't know which of the "ghetto" (free and cheap) hosting providers permit WebDAV access to person web site data. A search shows that GoDaddy does (or once did?) offer WevDAV access to "Online Storage" but that might not be the same thing as your web site files.
The problem is the evil PHP combined with the flaky Apache. Before a more recent version of the PHP software the Apache "mod" for PHP breaks all kinds of rules and makes it impossible to use the WebDAV "mod." However, being "open sores" software, i.e. a big bag o' bugs, the newer PHP hasn't been beaten to death enough to iron out enough bugs for these el-cheapo hosting outfits to move to it... so perhaps no soup for you!
Silly since the newer PHP is probably 10 years old now, but that's the world of open sores software.
Sounds like they've left you hat-in-hand with only creaky old problematic FTP as an option.
Re: Using VB6 to upload files to my GODADDY-hosted FTP
Code:
mput mytextfilename.txt
My guess would be that it expects more than one filename. If you just want to transfer a single file use
Code:
Put mytextfilename.txt
I also have a GoDaddy hosted FTP and I use FTP Put from the command line from time to time to upload a file, never had any issues with it.
Re: Using VB6 to upload files to my GODADDY-hosted FTP
Quote:
Originally Posted by
Krass
...everything seems to be working until I hit the mput command, which results in "200 PORT command successful", quickly followed by "425 Could not open data connection to port 59501: No route to host".
Ahh. I missed seeing that when I replied to your PM regarding WebDAV as an alternative.
One of the things about FTP is that it is hostile to firewalls and NAT routers. The problem is that it normally requires a connection back to you for the seprate channel (TCP connection) that it uses for data transfer. This means an FTP "client" must also be a "server." This "back channel" gets blocked by network devices pretty routinely.
Now, if both your FTP client and the remote FTP support a hack that was added in the 1980s to get around this limitation one way to get around this is to activate it for your FTP session. This is so-called "passive mode FTP" and you turn that on in your client either with a command-line switch or a command entered once you have connected the command channel and logged on. But both ends must support this mode.
Because even that can be problematic, since (a.) most end-users don't know much about FTP or computers in general and (b.) many FTP client and server products don't even support "passive mode" in 2015. As a workaround for this many SOHO routers have configration options you can turn on so that they will automagically punch holes through their own security and do NAT port mapping as required to make 1970s-style FTP work.
If you can get to your home router admin interface and log on there you might be able to find this option for FTP and turn it on. Every router is different, but in the web admin pages they usually have a section on "applications" or "advanced" or something where you can allow different common complex protocols to bypass network security automagically.
See How to FTP through a NAT router/firewall for a brief overview.
Note that most PC users also run a software firewall locally (Windows Firewall or an alternative product) and that must allow those FTP data-channel back-connections to come back inbound too.
Re: Using VB6 to upload files to my GODADDY-hosted FTP
Please see Schmidt's post #12 in the following thread. I had this exact same need, and his code works flawlessly for uploading to GoDaddy via FTP.
http://www.vbforums.com/showthread.p...795-FTP-Upload
Give him a rating while you're at it.
Re: Using VB6 to upload files to my GODADDY-hosted FTP
The reason it works for Go Daddy is because those sites always start at "\" for the home folder (at least all that I have seen) which is what Schmidt's code does which is good since I have several sites hosted by Go Daddy but unfortunately not all websites start at "\" in which case his code will not work
1 Attachment(s)
Re: Using VB6 to upload files to my GODADDY-hosted FTP
Quote:
Originally Posted by
jmsrickland
The reason it works for Go Daddy is because those sites always start at "\" for the home folder (at least all that I have seen) which is what Schmidt's code does which is good since I have several sites hosted by Go Daddy but unfortunately not all websites start at "\" in which case his code will not work
Just did a little revision of the Demo - and changed a few things
- as e.g. calling PWD = Print_Working_Directory after login,
. to work from that current UserRoot-folder in the Tree
- plus a few other changes - e.g. better IIS-DirListing-compatibility.
Here is the new version:
Attachment 133641
Note, that I still don't consider this a perfect FTP-Client - I wrote it
mainly for myself at that time, using (and testing) it with only a very
limited amount of FTP-Servers...
Olaf