It is possible to upload files to your web server using the Windows command line. The command line has an inbuilt tool that will allow you to connect to your web server using FTP. However, I would recommend you not to use this as it is a bit difficult and you have to enter commands through the keyboards. There are many free FTP clients available on the Internet which will make it easier to work.
As you may be aware, FTP stands for File Transfer Protocol and is a way by means of which one can transfer files from one computer to another. FTP is the standard protocol that most web designers use to transfer files to their web servers from their computers. In fact, many tools like Dreamweaver, GoLive, etc come with an FTP client installed so that the user can upload files easily.
Here is how you proceed to use FTP through the command line. Note that the commands are NOT case sensitive and so you can type either in upper case or lower case letters.
Step 1: Open the command line
You can do this by going to Start>Run and then typing “CMD” and pressing Enter. Navigate to the correct folder which contains the files that you want to upload. For example if your files are on the D: , enter d: in the command prompt and it will switch to D:. I am using C: Drive.
Step 2: Connect to your server using FTP
Type “FTP” followed by your FTP address. This is shown below:
In my case ftp.pcsplace.com is my FTP address. It will be like ftp.yourdomainname.com in your case.
Then enter your username and password. If it looks like the image shown below, it means you have successfully connected to your web server.
You might have observed that when you type your password, you won’t see anything on the screen, no dots or asterisk marks. This is to ensure the safety of your password.
Step 3: Uploading your files
In order to upload your files, first you will have to navigate to the correct directory. Usually, the root of your domain will be either “public_html” or “www”. However, in my case it is “/” i.e., Root directory. You can see the directories that are present on your web server by using the “DIR” command. Just enter “DIR” and you will see all the directories that are present.
To change to the directory the command is cd (i.e. change directory). Type cd followed by the name of the folder you want to change to.
Ex: cd uploads
You can check the current directory by typing PWD. Now let us upload a file. In my case, I will uploading a file called prasanthchandra.jpg. It is an image file. To do that we have to use the PUT command. Here is how that is done.
To upload a file, just type “put” followed by the name of your file and it will get uploaded. It will also provide you with statistics about the file like its size, how long it took to upload and your network speed.
Step 4: Verifying the Uploaded files
You should always verify that the files have been uploaded correctly. You can do this by pointing your browser to yourdomainname.com/nameoftheuploadedfile. If something goes wrong, you will have to upload the file again.
Step 5: Closing the FTP connection
You can close the FTP connection by typing “bye” at the FTP prompt.
If you wait for sometime, you will automatically get disconnected. This is for security reasons. You can use the command line feature if you don’t have any ftp client or if you are comfortable with command line. Leave your queries as comments..
How do you password protect a Blogger blog on a custom domain?
This is Mike again. I am adding some information to my earlier question.
I have figured out that the file is being uploaded to the KCMExt server to the C:\Windows\System32\LogFiles\W3SVC1649540525 path.
I just started working here and the programmer who created the web app and this ftp file uploading does not work here anymore. He left before I started working.
I am not familiar with using ftp file transfer and ftp commands.
So now I guess that I will try to figure out how to try to move the file from KCMExt’s C drive’s path to KCMExt’s E drive path. After the web app on KCMInt uploads to KCMExt’s C drive’s path as it currently does, maybe I will try to have the web app run a script (maybe bat file or something like that) that I will create and write and that will reside on KCMExt and that script on KCMExt will move from C drive to E drive’s path.
Anyway, thank you for this How To Use FTP Through the Command Line article.
If anybody has any ideas on how I should proceed with concern to the need to automate the moving of the file from KCMExt’s C drive path to KCMExt’s E drive path, please let me know.
Thanks again,
Mike mwitt@stinson.com
Greetings,
I wanted to ask a question in connection to the PUT command.
I am on a server named for example KCMInt. There are various paths on its D drive that have files. There is a different web server named for example KCMExt. It has an E drive with various paths as well as other drives.
There is a vb.net web app that uses VB rather than C# in the code behind pages. In a code behind page, there is code that runs FTP command line code to upload a file from KCMInt to KCMExt.
I am wondering in the PUT command how to specify to what drive and path on KCMExt the file should be uploaded?
When I view the response.tmp file when running the code from the web app, I see that the KCMExt is opened. I see that the user is logged in. I see the PUT filename.pdf for example. There is no error or anything, but I do not see that the file was uploaded to KCMExt.
The code that is run from the web app is as follows:
D:\WebsiteAdmin\ftp\cmd.exe /c D:\WebsiteAdmin\ftp\ftp.exe -s:D:\WebsiteAdmin\ftp\wwwupload.ftp > D:\WebsiteAdmin\ftp\response.tmp
The code behind’s applicable code shows that the correct drive and path are used for the file on the KCMInt server and that the filename is correct.
When the put command tries to put/upload that file, to where on KCMExt will the file be uploaded? Where or how can I direct the process to upload to a specific drive and path on the KCMExt web server?
There is no error but I do not find that the file was uploaded to KCMExt.
Thanks much,
Mike mwitt@stinson.com
In case you haven’t solve it yet !!!
You have to make sure you are in the correct directory of both local and remote! Below is a VB6 code using the Microsoft Internet Transfer Control 6.0 object.
Form2.Inet1.Execute , “PUT ” & “c:” & localfile & ” ” & remotefile
1. my “C:” is the local directory where my local file is located!
2. you must have previously opened the FTP server and the remote directory you want to place the file!
hope this helps!